deku 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +6 -0
- data/Gemfile +5 -0
- data/LICENSE +25 -0
- data/README.md +28 -0
- data/Rakefile +1 -0
- data/deku.gemspec +23 -0
- data/deps/node_modules/deku.js +2 -0
- data/deps/node_modules/deku/.editorconfig +16 -0
- data/deps/node_modules/deku/.zuul.yml +15 -0
- data/deps/node_modules/deku/History.md +290 -0
- data/deps/node_modules/deku/LICENSE.md +7 -0
- data/deps/node_modules/deku/Makefile +91 -0
- data/deps/node_modules/deku/README.md +293 -0
- data/deps/node_modules/deku/index.js +4072 -0
- data/deps/node_modules/deku/lib/application.js +85 -0
- data/deps/node_modules/deku/lib/index.js +28 -0
- data/deps/node_modules/deku/lib/render.js +1300 -0
- data/deps/node_modules/deku/lib/stringify.js +105 -0
- data/deps/node_modules/deku/lib/svg.js +107 -0
- data/deps/node_modules/deku/lib/utils.js +18 -0
- data/deps/node_modules/deku/lib/virtual.js +247 -0
- data/deps/node_modules/deku/node_modules/array-flatten/LICENSE +21 -0
- data/deps/node_modules/deku/node_modules/array-flatten/README.md +43 -0
- data/deps/node_modules/deku/node_modules/array-flatten/array-flatten.js +57 -0
- data/deps/node_modules/deku/node_modules/array-flatten/package.json +62 -0
- data/deps/node_modules/deku/node_modules/component-emitter/History.md +63 -0
- data/deps/node_modules/deku/node_modules/component-emitter/LICENSE +24 -0
- data/deps/node_modules/deku/node_modules/component-emitter/Readme.md +74 -0
- data/deps/node_modules/deku/node_modules/component-emitter/index.js +161 -0
- data/deps/node_modules/deku/node_modules/component-emitter/package.json +174 -0
- data/deps/node_modules/deku/node_modules/component-raf/.npmignore +2 -0
- data/deps/node_modules/deku/node_modules/component-raf/History.md +26 -0
- data/deps/node_modules/deku/node_modules/component-raf/Makefile +11 -0
- data/deps/node_modules/deku/node_modules/component-raf/Readme.md +46 -0
- data/deps/node_modules/deku/node_modules/component-raf/component.json +16 -0
- data/deps/node_modules/deku/node_modules/component-raf/example.html +43 -0
- data/deps/node_modules/deku/node_modules/component-raf/index.js +34 -0
- data/deps/node_modules/deku/node_modules/component-raf/package.json +164 -0
- data/deps/node_modules/deku/node_modules/component-type/.npmignore +3 -0
- data/deps/node_modules/deku/node_modules/component-type/Makefile +14 -0
- data/deps/node_modules/deku/node_modules/component-type/Readme.md +37 -0
- data/deps/node_modules/deku/node_modules/component-type/component.json +13 -0
- data/deps/node_modules/deku/node_modules/component-type/index.js +34 -0
- data/deps/node_modules/deku/node_modules/component-type/package.json +120 -0
- data/deps/node_modules/deku/node_modules/component-type/test/index.html +17 -0
- data/deps/node_modules/deku/node_modules/component-type/test/mocha.css +231 -0
- data/deps/node_modules/deku/node_modules/component-type/test/mocha.js +5340 -0
- data/deps/node_modules/deku/node_modules/component-type/test/tests.js +72 -0
- data/deps/node_modules/deku/node_modules/dom-pool/.npmignore +1 -0
- data/deps/node_modules/deku/node_modules/dom-pool/Pool.js +52 -0
- data/deps/node_modules/deku/node_modules/dom-pool/README.md +42 -0
- data/deps/node_modules/deku/node_modules/dom-pool/authors.txt +4 -0
- data/deps/node_modules/deku/node_modules/dom-pool/bower.json +26 -0
- data/deps/node_modules/deku/node_modules/dom-pool/package.json +46 -0
- data/deps/node_modules/deku/node_modules/dom-pool/tests.html +16 -0
- data/deps/node_modules/deku/node_modules/dom-pool/tests.js +102 -0
- data/deps/node_modules/deku/node_modules/dom-walk/.npmignore +3 -0
- data/deps/node_modules/deku/node_modules/dom-walk/LICENCE +19 -0
- data/deps/node_modules/deku/node_modules/dom-walk/Makefile +2 -0
- data/deps/node_modules/deku/node_modules/dom-walk/README.md +23 -0
- data/deps/node_modules/deku/node_modules/dom-walk/example/index.js +5 -0
- data/deps/node_modules/deku/node_modules/dom-walk/example/static/bundle.js +211 -0
- data/deps/node_modules/deku/node_modules/dom-walk/example/static/index.html +16 -0
- data/deps/node_modules/deku/node_modules/dom-walk/index.js +24 -0
- data/deps/node_modules/deku/node_modules/dom-walk/package.json +57 -0
- data/deps/node_modules/deku/node_modules/fast.js/.jshintignore +7 -0
- data/deps/node_modules/deku/node_modules/fast.js/.jshintrc +80 -0
- data/deps/node_modules/deku/node_modules/fast.js/.npmignore +6 -0
- data/deps/node_modules/deku/node_modules/fast.js/.travis.yml +3 -0
- data/deps/node_modules/deku/node_modules/fast.js/LICENSE.md +21 -0
- data/deps/node_modules/deku/node_modules/fast.js/README.md +552 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/clone.js +21 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/concat.js +32 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/every.js +25 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/fill.js +29 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/filter.js +26 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/forEach.js +21 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/index.js +15 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/indexOf.js +33 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/lastIndexOf.js +29 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/map.js +24 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/pluck.js +24 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/reduce.js +35 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/reduceRight.js +35 -0
- data/deps/node_modules/deku/node_modules/fast.js/array/some.js +25 -0
- data/deps/node_modules/deku/node_modules/fast.js/bower.json +28 -0
- data/deps/node_modules/deku/node_modules/fast.js/clone.js +27 -0
- data/deps/node_modules/deku/node_modules/fast.js/dist/bench.html +15 -0
- data/deps/node_modules/deku/node_modules/fast.js/dist/bench.js +19900 -0
- data/deps/node_modules/deku/node_modules/fast.js/dist/fast.js +1450 -0
- data/deps/node_modules/deku/node_modules/fast.js/dist/fast.min.js +1 -0
- data/deps/node_modules/deku/node_modules/fast.js/filter.js +23 -0
- data/deps/node_modules/deku/node_modules/fast.js/forEach.js +22 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/apply.js +19 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/applyNoContext.js +29 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/applyWithContext.js +29 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/bind.js +71 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/bindInternal3.js +11 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/bindInternal4.js +11 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/index.js +7 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/partial.js +42 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/partialConstructor.js +45 -0
- data/deps/node_modules/deku/node_modules/fast.js/function/try.js +35 -0
- data/deps/node_modules/deku/node_modules/fast.js/index.js +241 -0
- data/deps/node_modules/deku/node_modules/fast.js/map.js +23 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/assign.js +34 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/clone.js +25 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/filter.js +28 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/forEach.js +23 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/index.js +11 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/keys.js +17 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/map.js +26 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/reduce.js +37 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/reduceRight.js +37 -0
- data/deps/node_modules/deku/node_modules/fast.js/object/values.js +20 -0
- data/deps/node_modules/deku/node_modules/fast.js/package.json +73 -0
- data/deps/node_modules/deku/node_modules/fast.js/reduce.js +24 -0
- data/deps/node_modules/deku/node_modules/fast.js/reduceRight.js +24 -0
- data/deps/node_modules/deku/node_modules/fast.js/string/index.js +3 -0
- data/deps/node_modules/deku/node_modules/fast.js/string/intern.js +56 -0
- data/deps/node_modules/deku/node_modules/get-uid/README.md +44 -0
- data/deps/node_modules/deku/node_modules/get-uid/index.js +6 -0
- data/deps/node_modules/deku/node_modules/get-uid/package.json +56 -0
- data/deps/node_modules/deku/node_modules/is-dom/HISTORY.md +2 -0
- data/deps/node_modules/deku/node_modules/is-dom/LICENSE +21 -0
- data/deps/node_modules/deku/node_modules/is-dom/README.md +32 -0
- data/deps/node_modules/deku/node_modules/is-dom/index.js +15 -0
- data/deps/node_modules/deku/node_modules/is-dom/package.json +62 -0
- data/deps/node_modules/deku/node_modules/object-path/.npmignore +7 -0
- data/deps/node_modules/deku/node_modules/object-path/.travis.yml +6 -0
- data/deps/node_modules/deku/node_modules/object-path/LICENSE +21 -0
- data/deps/node_modules/deku/node_modules/object-path/README.md +96 -0
- data/deps/node_modules/deku/node_modules/object-path/bower.json +17 -0
- data/deps/node_modules/deku/node_modules/object-path/component.json +22 -0
- data/deps/node_modules/deku/node_modules/object-path/index.js +269 -0
- data/deps/node_modules/deku/node_modules/object-path/package.json +89 -0
- data/deps/node_modules/deku/node_modules/object-path/test.js +510 -0
- data/deps/node_modules/deku/node_modules/per-frame/.npmignore +68 -0
- data/deps/node_modules/deku/node_modules/per-frame/History.md +32 -0
- data/deps/node_modules/deku/node_modules/per-frame/README.md +44 -0
- data/deps/node_modules/deku/node_modules/per-frame/component.json +13 -0
- data/deps/node_modules/deku/node_modules/per-frame/index.js +37 -0
- data/deps/node_modules/deku/node_modules/per-frame/package.json +143 -0
- data/deps/node_modules/deku/node_modules/per-frame/test/test.js +94 -0
- data/deps/node_modules/deku/node_modules/sliced/.npmignore +2 -0
- data/deps/node_modules/deku/node_modules/sliced/.travis.yml +4 -0
- data/deps/node_modules/deku/node_modules/sliced/History.md +30 -0
- data/deps/node_modules/deku/node_modules/sliced/LICENSE +22 -0
- data/deps/node_modules/deku/node_modules/sliced/Makefile +5 -0
- data/deps/node_modules/deku/node_modules/sliced/README.md +62 -0
- data/deps/node_modules/deku/node_modules/sliced/bench.js +95 -0
- data/deps/node_modules/deku/node_modules/sliced/component.json +14 -0
- data/deps/node_modules/deku/node_modules/sliced/index.js +1 -0
- data/deps/node_modules/deku/node_modules/sliced/lib/sliced.js +33 -0
- data/deps/node_modules/deku/node_modules/sliced/package.json +52 -0
- data/deps/node_modules/deku/node_modules/sliced/test/index.js +80 -0
- data/deps/node_modules/deku/package.json +67 -0
- data/lib/deku.rb +11 -0
- data/lib/deku/application.rb +16 -0
- data/lib/deku/component.rb +36 -0
- data/lib/deku/context.rb +38 -0
- data/lib/deku/element_node.rb +17 -0
- data/lib/deku/version.rb +4 -0
- metadata +278 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Compiled source #
|
|
2
|
+
###################
|
|
3
|
+
*.com
|
|
4
|
+
*.class
|
|
5
|
+
*.dll
|
|
6
|
+
*.exe
|
|
7
|
+
*.o
|
|
8
|
+
*.so
|
|
9
|
+
|
|
10
|
+
# Packages #
|
|
11
|
+
############
|
|
12
|
+
# it's better to unpack these files and commit the raw source
|
|
13
|
+
# git has its own built in compression methods
|
|
14
|
+
*.7z
|
|
15
|
+
*.dmg
|
|
16
|
+
*.gz
|
|
17
|
+
*.iso
|
|
18
|
+
*.jar
|
|
19
|
+
*.rar
|
|
20
|
+
*.tar
|
|
21
|
+
*.zip
|
|
22
|
+
|
|
23
|
+
# Logs and databases #
|
|
24
|
+
######################
|
|
25
|
+
*.log
|
|
26
|
+
*.sql
|
|
27
|
+
*.sqlite
|
|
28
|
+
|
|
29
|
+
# OS generated files #
|
|
30
|
+
######################
|
|
31
|
+
.DS_Store*
|
|
32
|
+
ehthumbs.db
|
|
33
|
+
Icon?
|
|
34
|
+
Thumbs.db
|
|
35
|
+
|
|
36
|
+
# Node.js #
|
|
37
|
+
###########
|
|
38
|
+
lib-cov
|
|
39
|
+
*.seed
|
|
40
|
+
*.log
|
|
41
|
+
*.csv
|
|
42
|
+
*.dat
|
|
43
|
+
*.out
|
|
44
|
+
*.pid
|
|
45
|
+
*.gz
|
|
46
|
+
|
|
47
|
+
pids
|
|
48
|
+
logs
|
|
49
|
+
results
|
|
50
|
+
|
|
51
|
+
node_modules
|
|
52
|
+
npm-debug.log
|
|
53
|
+
|
|
54
|
+
# Git #
|
|
55
|
+
#######
|
|
56
|
+
*.orig
|
|
57
|
+
*.BASE.*
|
|
58
|
+
*.BACKUP.*
|
|
59
|
+
*.LOCAL.*
|
|
60
|
+
*.REMOTE.*
|
|
61
|
+
|
|
62
|
+
# Components #
|
|
63
|
+
##############
|
|
64
|
+
|
|
65
|
+
/build
|
|
66
|
+
/components
|
|
67
|
+
/landing/components
|
|
68
|
+
.elasticbeanstalk/
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
|
|
2
|
+
3.0.1 / 2015-02-27
|
|
3
|
+
==================
|
|
4
|
+
|
|
5
|
+
* package: allow any "zuul" v2
|
|
6
|
+
* update "component-raf" to v1.2.0
|
|
7
|
+
|
|
8
|
+
3.0.0 / 2014-09-24
|
|
9
|
+
==================
|
|
10
|
+
|
|
11
|
+
* README: tweak example
|
|
12
|
+
* package: add "zuul" as a dev dependency
|
|
13
|
+
* test: add initial mocha test cases
|
|
14
|
+
* index: refactor to invoke the function immediately (#1, @TooTallNate)
|
|
15
|
+
|
|
16
|
+
2.0.1 / 2014-06-13
|
|
17
|
+
==================
|
|
18
|
+
|
|
19
|
+
* add `pacakge.json` file
|
|
20
|
+
* component: pin "raf" to v1.1.3
|
|
21
|
+
|
|
22
|
+
2.0.0 / 2014-01-15
|
|
23
|
+
==================
|
|
24
|
+
|
|
25
|
+
* perserve context
|
|
26
|
+
* pass arguments through
|
|
27
|
+
* remove immediate
|
|
28
|
+
|
|
29
|
+
1.0.0 / 2014-01-09
|
|
30
|
+
==================
|
|
31
|
+
|
|
32
|
+
* initial release
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
# Per Frame
|
|
2
|
+
|
|
3
|
+
Executes a function at most once per animation frame. Kind of like throttle, but it throttles at ~60Hz.
|
|
4
|
+
|
|
5
|
+
## Example
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
var throttle = require('per-frame');
|
|
9
|
+
|
|
10
|
+
editor.oninput = throttle(function(e) {
|
|
11
|
+
console.log(e.value);
|
|
12
|
+
});
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## API
|
|
16
|
+
|
|
17
|
+
### var callback = throttle(fn)
|
|
18
|
+
|
|
19
|
+
`fn` is the function to be throttled. `callback` is `fn` throttled.
|
|
20
|
+
|
|
21
|
+
## License
|
|
22
|
+
|
|
23
|
+
The MIT License (MIT)
|
|
24
|
+
|
|
25
|
+
Copyright (c) 2014 Matthew Mueller mattmuelle@gmail.com
|
|
26
|
+
Copyright (c) 2014 Jonathan Ong me@jongleberry.com
|
|
27
|
+
|
|
28
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
29
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
30
|
+
in the Software without restriction, including without limitation the rights
|
|
31
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
32
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
33
|
+
furnished to do so, subject to the following conditions:
|
|
34
|
+
|
|
35
|
+
The above copyright notice and this permission notice shall be included in
|
|
36
|
+
all copies or substantial portions of the Software.
|
|
37
|
+
|
|
38
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
39
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
40
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
41
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
42
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
43
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
44
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module Dependencies.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
var raf = require('raf');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Export `throttle`.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
module.exports = throttle;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Executes a function at most once per animation frame. Kind of like
|
|
15
|
+
* throttle, but it throttles at ~60Hz.
|
|
16
|
+
*
|
|
17
|
+
* @param {Function} fn - the Function to throttle once per animation frame
|
|
18
|
+
* @return {Function}
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
|
|
22
|
+
function throttle(fn) {
|
|
23
|
+
var rtn;
|
|
24
|
+
var ignoring = false;
|
|
25
|
+
|
|
26
|
+
return function queue() {
|
|
27
|
+
if (ignoring) return rtn;
|
|
28
|
+
ignoring = true;
|
|
29
|
+
|
|
30
|
+
raf(function() {
|
|
31
|
+
ignoring = false;
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
rtn = fn.apply(this, arguments);
|
|
35
|
+
return rtn;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "per-frame",
|
|
3
|
+
"description": "throttle per animation frame",
|
|
4
|
+
"version": "3.0.1",
|
|
5
|
+
"component": {
|
|
6
|
+
"scripts": {
|
|
7
|
+
"per-frame/index.js": "index.js"
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"component-raf": "1.2.0"
|
|
12
|
+
},
|
|
13
|
+
"browser": {
|
|
14
|
+
"raf": "component-raf"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/component/per-frame.git"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"zuul": "2"
|
|
23
|
+
},
|
|
24
|
+
"gitHead": "959ed34d71dcb2ec726b030663157d67b7c0b5d2",
|
|
25
|
+
"bugs": {
|
|
26
|
+
"url": "https://github.com/component/per-frame/issues"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/component/per-frame",
|
|
29
|
+
"_id": "per-frame@3.0.1",
|
|
30
|
+
"scripts": {},
|
|
31
|
+
"_shasum": "3a8ee57703240d55b40b7799397e464e0b322765",
|
|
32
|
+
"_from": "per-frame@>=3.0.0 <4.0.0",
|
|
33
|
+
"_npmVersion": "1.4.28",
|
|
34
|
+
"_npmUser": {
|
|
35
|
+
"name": "tootallnate",
|
|
36
|
+
"email": "nathan@tootallnate.net"
|
|
37
|
+
},
|
|
38
|
+
"maintainers": [
|
|
39
|
+
{
|
|
40
|
+
"name": "tootallnate",
|
|
41
|
+
"email": "nathan@tootallnate.net"
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": "tjholowaychuk",
|
|
45
|
+
"email": "tj@vision-media.ca"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "rauchg",
|
|
49
|
+
"email": "rauchg@gmail.com"
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"name": "retrofox",
|
|
53
|
+
"email": "rdsuarez@gmail.com"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "coreh",
|
|
57
|
+
"email": "thecoreh@gmail.com"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "forbeslindesay",
|
|
61
|
+
"email": "forbes@lindesay.co.uk"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "mattmueller",
|
|
65
|
+
"email": "mattmuelle@gmail.com"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"name": "yields",
|
|
69
|
+
"email": "yields@icloud.com"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "anthonyshort",
|
|
73
|
+
"email": "antshort@gmail.com"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "jongleberry",
|
|
77
|
+
"email": "jonathanrichardong@gmail.com"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "cristiandouce",
|
|
81
|
+
"email": "cristian@gravityonmars.com"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "swatinem",
|
|
85
|
+
"email": "arpad.borsos@googlemail.com"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"name": "stagas",
|
|
89
|
+
"email": "gstagas@gmail.com"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "amasad",
|
|
93
|
+
"email": "amjad.masad@gmail.com"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "juliangruber",
|
|
97
|
+
"email": "julian@juliangruber.com"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"name": "shtylman",
|
|
101
|
+
"email": "shtylman@gmail.com"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "calvinfo",
|
|
105
|
+
"email": "calvin@calv.info"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"name": "dominicbarnes",
|
|
109
|
+
"email": "dominic@dbarnes.info"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"name": "clintwood",
|
|
113
|
+
"email": "clint@anotherway.co.za"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"name": "thehydroimpulse",
|
|
117
|
+
"email": "dnfagnan@gmail.com"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"name": "timoxley",
|
|
121
|
+
"email": "secoif@gmail.com"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "trevorgerhardt",
|
|
125
|
+
"email": "trevorgerhardt@gmail.com"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "timaschew",
|
|
129
|
+
"email": "timaschew@gmail.com"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"name": "hughsk",
|
|
133
|
+
"email": "hughskennedy@gmail.com"
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
"dist": {
|
|
137
|
+
"shasum": "3a8ee57703240d55b40b7799397e464e0b322765",
|
|
138
|
+
"tarball": "http://registry.npmjs.org/per-frame/-/per-frame-3.0.1.tgz"
|
|
139
|
+
},
|
|
140
|
+
"directories": {},
|
|
141
|
+
"_resolved": "https://registry.npmjs.org/per-frame/-/per-frame-3.0.1.tgz",
|
|
142
|
+
"readme": "ERROR: No README data found!"
|
|
143
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
|
|
2
|
+
var assert = require('assert');
|
|
3
|
+
var throttle = require('../');
|
|
4
|
+
|
|
5
|
+
describe('per-frame', function () {
|
|
6
|
+
|
|
7
|
+
it('should only invoke the given function 1 time when called repeatedly', function () {
|
|
8
|
+
|
|
9
|
+
var count = 0;
|
|
10
|
+
|
|
11
|
+
var fn = throttle(function () {
|
|
12
|
+
count++;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
assert(count === 0);
|
|
16
|
+
fn();
|
|
17
|
+
assert(count === 1);
|
|
18
|
+
fn();
|
|
19
|
+
assert(count === 1);
|
|
20
|
+
fn();
|
|
21
|
+
assert(count === 1);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should only invoke the given function 1 time per frame', function (done) {
|
|
25
|
+
|
|
26
|
+
var count = 0;
|
|
27
|
+
|
|
28
|
+
var fn = throttle(function () {
|
|
29
|
+
count++;
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
assert(count === 0);
|
|
33
|
+
fn();
|
|
34
|
+
assert(count === 1);
|
|
35
|
+
fn();
|
|
36
|
+
assert(count === 1);
|
|
37
|
+
fn();
|
|
38
|
+
assert(count === 1);
|
|
39
|
+
|
|
40
|
+
function one () {
|
|
41
|
+
assert(count === 1);
|
|
42
|
+
fn();
|
|
43
|
+
assert(count === 2);
|
|
44
|
+
fn();
|
|
45
|
+
assert(count === 2);
|
|
46
|
+
fn();
|
|
47
|
+
assert(count === 2);
|
|
48
|
+
|
|
49
|
+
setTimeout(two, 50);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function two () {
|
|
53
|
+
assert(count === 2);
|
|
54
|
+
fn();
|
|
55
|
+
assert(count === 3);
|
|
56
|
+
fn();
|
|
57
|
+
assert(count === 3);
|
|
58
|
+
fn();
|
|
59
|
+
assert(count === 3);
|
|
60
|
+
|
|
61
|
+
done();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
setTimeout(one, 50);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should cache the return value', function (done) {
|
|
68
|
+
var count = 0;
|
|
69
|
+
|
|
70
|
+
var fn = throttle(function () {
|
|
71
|
+
count++;
|
|
72
|
+
return count === 1 ? 'foo' : 'bar';
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
assert(count === 0);
|
|
76
|
+
assert.equal('foo', fn());
|
|
77
|
+
assert(count === 1);
|
|
78
|
+
assert.equal('foo', fn());
|
|
79
|
+
assert(count === 1);
|
|
80
|
+
assert.equal('foo', fn());
|
|
81
|
+
|
|
82
|
+
setTimeout(function () {
|
|
83
|
+
assert(count === 1);
|
|
84
|
+
assert.equal('bar', fn());
|
|
85
|
+
assert(count === 2);
|
|
86
|
+
assert.equal('bar', fn());
|
|
87
|
+
assert(count === 2);
|
|
88
|
+
assert.equal('bar', fn());
|
|
89
|
+
|
|
90
|
+
done();
|
|
91
|
+
}, 50);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
});
|