summaryrefslogtreecommitdiff
path: root/node_modules/throttleit
diff options
context:
space:
mode:
authorLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 22:54:37 +0300
committerLinuxWizard42 <computerwizard@linuxmail.org>2022-10-12 22:54:37 +0300
commit703e03aba33f234712206769f57717ba7d92d23d (patch)
tree0041f04ccb75bd5379c764e9fe42249fffe75fc3 /node_modules/throttleit
parentab6e257e6e9d9a483d7e86f220d8b209a2cd7753 (diff)
downloadFlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.gz
FlashRunner-703e03aba33f234712206769f57717ba7d92d23d.tar.zst
Added export_allowed file to make repository visible in cgit
Diffstat (limited to 'node_modules/throttleit')
-rw-r--r--node_modules/throttleit/.npmignore2
-rw-r--r--node_modules/throttleit/History.md11
-rw-r--r--node_modules/throttleit/Makefile11
-rw-r--r--node_modules/throttleit/Readme.md16
-rw-r--r--node_modules/throttleit/component.json13
-rw-r--r--node_modules/throttleit/example.js14
-rw-r--r--node_modules/throttleit/index.js30
-rw-r--r--node_modules/throttleit/package.json18
8 files changed, 115 insertions, 0 deletions
diff --git a/node_modules/throttleit/.npmignore b/node_modules/throttleit/.npmignore
new file mode 100644
index 0000000..48a2e24
--- /dev/null
+++ b/node_modules/throttleit/.npmignore
@@ -0,0 +1,2 @@
+components
+build
diff --git a/node_modules/throttleit/History.md b/node_modules/throttleit/History.md
new file mode 100644
index 0000000..fdf168e
--- /dev/null
+++ b/node_modules/throttleit/History.md
@@ -0,0 +1,11 @@
+
+0.0.2 / 2013-03-26
+==================
+
+ - Cache the return value
+ - Don't use `setTimeout()`
+
+0.0.1 / 2013-03-26
+==================
+
+ - Initial release
diff --git a/node_modules/throttleit/Makefile b/node_modules/throttleit/Makefile
new file mode 100644
index 0000000..0f14dac
--- /dev/null
+++ b/node_modules/throttleit/Makefile
@@ -0,0 +1,11 @@
+
+build: components index.js
+ @component build --dev
+
+components: component.json
+ @component install --dev
+
+clean:
+ rm -fr build components template.js
+
+.PHONY: clean
diff --git a/node_modules/throttleit/Readme.md b/node_modules/throttleit/Readme.md
new file mode 100644
index 0000000..3d8bd83
--- /dev/null
+++ b/node_modules/throttleit/Readme.md
@@ -0,0 +1,16 @@
+
+# throttle
+
+ Throttle a function
+
+## Installation
+
+ $ component install component/throttle
+
+## API
+
+
+
+## License
+
+ MIT
diff --git a/node_modules/throttleit/component.json b/node_modules/throttleit/component.json
new file mode 100644
index 0000000..7cf81a0
--- /dev/null
+++ b/node_modules/throttleit/component.json
@@ -0,0 +1,13 @@
+{
+ "name": "throttle",
+ "repo": "component/throttle",
+ "description": "Throttle a function",
+ "version": "0.0.2",
+ "keywords": [],
+ "dependencies": {},
+ "development": {},
+ "license": "MIT",
+ "scripts": [
+ "index.js"
+ ]
+}
diff --git a/node_modules/throttleit/example.js b/node_modules/throttleit/example.js
new file mode 100644
index 0000000..a7f0f62
--- /dev/null
+++ b/node_modules/throttleit/example.js
@@ -0,0 +1,14 @@
+
+var throttle = require('./');
+
+function onprogress(n) {
+ console.log('progress %s%', n);
+}
+
+onprogress = throttle(onprogress, 500);
+
+var n = 0;
+setInterval(function(){
+ if (n >= 100) return;
+ onprogress(n++);
+}, 50);
diff --git a/node_modules/throttleit/index.js b/node_modules/throttleit/index.js
new file mode 100644
index 0000000..d9efe3c
--- /dev/null
+++ b/node_modules/throttleit/index.js
@@ -0,0 +1,30 @@
+
+/**
+ * Module exports.
+ */
+
+module.exports = throttle;
+
+/**
+ * Returns a new function that, when invoked, invokes `func` at most one time per
+ * `wait` milliseconds.
+ *
+ * @param {Function} func The `Function` instance to wrap.
+ * @param {Number} wait The minimum number of milliseconds that must elapse in between `func` invokations.
+ * @return {Function} A new function that wraps the `func` function passed in.
+ * @api public
+ */
+
+function throttle (func, wait) {
+ var rtn; // return value
+ var last = 0; // last invokation timestamp
+ return function throttled () {
+ var now = new Date().getTime();
+ var delta = now - last;
+ if (delta >= wait) {
+ rtn = func.apply(this, arguments);
+ last = now;
+ }
+ return rtn;
+ };
+}
diff --git a/node_modules/throttleit/package.json b/node_modules/throttleit/package.json
new file mode 100644
index 0000000..709467b
--- /dev/null
+++ b/node_modules/throttleit/package.json
@@ -0,0 +1,18 @@
+{
+ "name": "throttleit",
+ "description": "Throttle a function",
+ "version": "0.0.2",
+ "keywords": [],
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/component/throttle.git"
+ },
+ "dependencies": {},
+ "development": {},
+ "license": "MIT",
+ "component": {
+ "scripts": {
+ "throttle/index.js": "index.js"
+ }
+ }
+}