src/plugins/user-activity-events/client.js
function throttle(fn) {
	var called = false;
	var throttled = false;
	var timeout = 10000;

	function unthrottled() {
		throttled = false;
		maybeCall();
	}

	function maybeCall() {
		if (called && !throttled) {
			called = false;
			throttled = true;
			setTimeout(unthrottled, timeout);
			fn();
		}
	}

	return function() {
		called = true;
		maybeCall();
	};
}
function throttle(fn) {
	var called = false;
	var throttled = false;
	var timeout = 10000;

	function unthrottled() {
		throttled = false;
		maybeCall();
	}

	function maybeCall() {
		if (called && !throttled) {
			called = false;
			throttled = true;
			setTimeout(unthrottled, timeout);
			fn();
		}
	}

	return function() {
		called = true;
		maybeCall();
	};
}
function throttle ( fn ) { var called = false ; var throttled = false ; var timeout = 10000 ; function unthrottled ( ) { throttled = false ; maybeCall ( ) ; } function maybeCall ( ) { if ( called && ! throttled ) { called = false ; throttled = true ; setTimeout ( unthrottled , timeout ) ; fn ( ) ; } } return function ( ) { called = true ; maybeCall ( ) ; } ; }
Call fn immediately, and then don't call again until after timeout has passed If it is called one or more times within the timeout, fn is called at the trailing edge of the timeout as well, and then re-throttled
Call fn immediately and then don t call again until after timeout has passed If it is called one or more times within the timeout fn is called at the trailing edge of the timeout as well and then re - throttled