throttle function
The function is called at most once in a specified time period the function is called with the latest arguments
Implementation
Function throttle(int ms, Function target, List arguments) {
var last = 0;
return () {
var now = DateTime.now().millisecondsSinceEpoch;
if (now - last > ms) {
last = now;
Function.apply(target, arguments);
}
};
}