artdaq_node_server
v1_00_08
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Variables
Pages
src
node_modules
xml2js
node_modules
xmlbuilder
node_modules
lodash
_shortOut.js
1
2
var HOT_COUNT = 800,
3
HOT_SPAN = 16;
4
5
/* Built-in method references for those with the same name as other `lodash` methods. */
6
var nativeNow = Date.now;
7
17
function
shortOut(func) {
18
var count = 0,
19
lastCalled = 0;
20
21
return
function
() {
22
var stamp = nativeNow(),
23
remaining = HOT_SPAN - (stamp - lastCalled);
24
25
lastCalled = stamp;
26
if
(remaining > 0) {
27
if
(++count >= HOT_COUNT) {
28
return
arguments[0];
29
}
30
}
else
{
31
count = 0;
32
}
33
return
func.apply(undefined, arguments);
34
};
35
}
36
37
module.exports = shortOut;
Generated on Thu Jun 1 2017 11:57:21 for artdaq_node_server by
1.8.5