Skip to content

Commit 2ea6e0e

Browse files
committed
Initial publish
1 parent 0216823 commit 2ea6e0e

27 files changed

+2476
-2
lines changed

.npmignore

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# Compiled binary addons (http://nodejs.org/api/addons.html)
20+
build/Release
21+
22+
# Dependency directory
23+
# Commenting this out is preferred by some people, see
24+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
25+
node_modules
26+
27+
# Users Environment Variables
28+
.lock-wscript
29+
30+
31+
32+
# only for npm
33+
.zuul.yml
34+
.travis.yml

.travis.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
language: node_js
2+
node_js:
3+
- '0.12'
4+
env:
5+
global:
6+
- secure: p0AJduyYAYudJP+ihiZCdFgs/exP4S+ZisJEhrLwnStntXhhBGPCdQNqnVYyFRRDIWY16igpLKEwo1d3MFtboe9i16K9YE+oxRzu2/BqqwmrvyI4+I1onk0MJLWz2KZX7Deyvh5+CG+CkPTuhpnpKff7XpBLTYZIlLNUiN1fLd8=
7+
- secure: vfEHk2lAQeP0dTZ4N4n2mvIwCGp4bMei/17D8rWpBXzdKSJ9XnyBT1yz7mi0dxXjVZESSnC03t1+g02omq4TweLz0OUAoV1IGQK0kZOeh8SlbpIkuSVF3/fR37LLdyPHun1ngTbGCOLI/N64QPkdRInyLGQi75L9MxVoGlzqHbQ=

.zuul.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
ui: tape
2+
browsers:
3+
- name: chrome
4+
version: 36..latest
5+
- name: firefox
6+
version: 25..latest
7+
- name: safari
8+
version: 5..latest
9+
- name: ie
10+
version: 6..latest
11+
- name: opera
12+
version: 11..latest
13+
- name: iphone
14+
version: 4.3..latest
15+
- name: ipad
16+
version: 4.3..latest
17+
- name: android
18+
version: 4.0..latest

LICENSE

+54-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015 Jan Schär
3+
Copyright (c) 2015 Jan Schär, and other contributors.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -20,3 +20,56 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
2222

23+
24+
25+
The main files of this repository are from joyent/node with modifications for
26+
use with browserify. They have the following license:
27+
28+
29+
Copyright Joyent, Inc. and other Node contributors.
30+
31+
Permission is hereby granted, free of charge, to any person obtaining a
32+
copy of this software and associated documentation files (the
33+
"Software"), to deal in the Software without restriction, including
34+
without limitation the rights to use, copy, modify, merge, publish,
35+
distribute, sublicense, and/or sell copies of the Software, and to permit
36+
persons to whom the Software is furnished to do so, subject to the
37+
following conditions:
38+
39+
The above copyright notice and this permission notice shall be included
40+
in all copies or substantial portions of the Software.
41+
42+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
43+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
44+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
45+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
46+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
47+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
48+
USE OR OTHER DEALINGS IN THE SOFTWARE.
49+
50+
51+
52+
The files in bin/ are originally from feross/buffer. They are modified too.
53+
54+
55+
The MIT License (MIT)
56+
57+
Copyright (c) Feross Aboukhadijeh, and other contributors.
58+
59+
Permission is hereby granted, free of charge, to any person obtaining a copy
60+
of this software and associated documentation files (the "Software"), to deal
61+
in the Software without restriction, including without limitation the rights
62+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
63+
copies of the Software, and to permit persons to whom the Software is
64+
furnished to do so, subject to the following conditions:
65+
66+
The above copyright notice and this permission notice shall be included in
67+
all copies or substantial portions of the Software.
68+
69+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
70+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
71+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
72+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
73+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
74+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
75+
THE SOFTWARE.

README.md

+51-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,52 @@
11
# timers-browserify-full
2-
timers module based on nodes code for browserify
2+
3+
This module is based on the original source files of node v0.12.0. This means that it is
4+
as compatible to node as possible, and it also uses linked lists like node. But
5+
it also means that it is quite heavy, and not necessary for most browserify
6+
projects. If you don't heavily use timers, the [timers-browserify](https://www.npmjs.com/package/timers-browserify)
7+
module, which is already integrated in browserify, is probably better suited.
8+
9+
## install / usage with browserify
10+
11+
```bash
12+
npm install timers-browserify-full
13+
```
14+
15+
To use it with browserify, you have to use the js API of browserify;
16+
the command line API does not support changing builtins.
17+
18+
Example:
19+
20+
```js
21+
var browserify = require('browserify');
22+
23+
var builtins = require('browserify/lib/builtins.js');
24+
builtins.timers = require.resolve('timers-browserify-full');
25+
26+
var b = browserify();
27+
28+
b.add(...
29+
```
30+
31+
The above example will use timers-browserify-full for all browserify builds.
32+
If you only want it for a specific build of a larger build script:
33+
34+
```js
35+
var browserify = require('browserify');
36+
37+
var builtins = require('browserify/lib/builtins.js');
38+
var myBuiltins = {};
39+
Object.keys(builtins).forEach(function(key) {
40+
myBuiltins[key] = builtins[key];
41+
});
42+
43+
myBuiltins.timers = require.resolve('timers-browserify-full')
44+
45+
var b = browserify({builtins: myBuiltins});
46+
47+
b.add(...
48+
```
49+
50+
## license
51+
52+
MIT

_linklist.js

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
// Copyright Joyent, Inc. and other Node contributors.
2+
//
3+
// Permission is hereby granted, free of charge, to any person obtaining a
4+
// copy of this software and associated documentation files (the
5+
// "Software"), to deal in the Software without restriction, including
6+
// without limitation the rights to use, copy, modify, merge, publish,
7+
// distribute, sublicense, and/or sell copies of the Software, and to permit
8+
// persons to whom the Software is furnished to do so, subject to the
9+
// following conditions:
10+
//
11+
// The above copyright notice and this permission notice shall be included
12+
// in all copies or substantial portions of the Software.
13+
//
14+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
17+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
18+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
21+
22+
function init(list) {
23+
list._idleNext = list;
24+
list._idlePrev = list;
25+
}
26+
exports.init = init;
27+
28+
29+
// show the most idle item
30+
function peek(list) {
31+
if (list._idlePrev == list) return null;
32+
return list._idlePrev;
33+
}
34+
exports.peek = peek;
35+
36+
37+
// remove the most idle item from the list
38+
function shift(list) {
39+
var first = list._idlePrev;
40+
remove(first);
41+
return first;
42+
}
43+
exports.shift = shift;
44+
45+
46+
// remove a item from its list
47+
function remove(item) {
48+
if (item._idleNext) {
49+
item._idleNext._idlePrev = item._idlePrev;
50+
}
51+
52+
if (item._idlePrev) {
53+
item._idlePrev._idleNext = item._idleNext;
54+
}
55+
56+
item._idleNext = null;
57+
item._idlePrev = null;
58+
}
59+
exports.remove = remove;
60+
61+
62+
// remove a item from its list and place at the end.
63+
function append(list, item) {
64+
remove(item);
65+
item._idleNext = list._idleNext;
66+
list._idleNext._idlePrev = item;
67+
item._idlePrev = list;
68+
list._idleNext = item;
69+
}
70+
exports.append = append;
71+
72+
73+
function isEmpty(list) {
74+
return list._idleNext === list;
75+
}
76+
exports.isEmpty = isEmpty;

all-tests.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This file is automatically generated by bin/download-node-tests.js
2+
require('./test/node-pummel-test-timers.js')
3+
require('./test/node-test-timers-first-fire.js')
4+
require('./test/node-test-timers-immediate-queue.js')
5+
require('./test/node-test-timers-immediate.js')
6+
require('./test/node-test-timers-linked-list.js')
7+
require('./test/node-test-timers-non-integer-delay.js')
8+
require('./test/node-test-timers-ordering.js')
9+
require('./test/node-test-timers-this.js')
10+
require('./test/node-test-timers-unref-active.js')
11+
require('./test/node-test-timers-unref-remove-other-unref-timers-only-one-fires.js')
12+
require('./test/node-test-timers-unref-remove-other-unref-timers.js')
13+
require('./test/node-test-timers-unrefd-interval-still-fires.js')
14+
require('./test/node-test-timers-zero-timeout.js')
15+
require('./test/node-test-timers.js')
16+
require('./test/test-unref.js')
17+
require('./test/test.js')

0 commit comments

Comments
 (0)