Browse files

[dist] add gitignore

  • Loading branch information...
1 parent 62731ab commit 1f900aa2004e54a42faff6801c08af14638556e1 @ecto committed Feb 21, 2012
Showing with 1 addition and 19,832 deletions.
  1. +1 −0 .gitignore
  2. +0 −13 node_modules/eventemitter2/.npmignore
  3. +0 −202 node_modules/eventemitter2/README.md
  4. +0 −1 node_modules/eventemitter2/index.js
  5. +0 −547 node_modules/eventemitter2/lib/eventemitter2.js
  6. +0 −33 node_modules/eventemitter2/package.json
  7. +0 −123 node_modules/eventemitter2/test/common.js
  8. +0 −53 node_modules/eventemitter2/test/perf/benchmark.js
  9. +0 −192 node_modules/eventemitter2/test/simple/addListener.js
  10. +0 −136 node_modules/eventemitter2/test/simple/emit.js
  11. +0 −199 node_modules/eventemitter2/test/simple/removeListener.js
  12. +0 −133 node_modules/eventemitter2/test/simple/setMax.js
  13. +0 −126 node_modules/eventemitter2/test/simple/ttl.js
  14. +0 −287 node_modules/eventemitter2/test/wildcardEvents/addListener.js
  15. +0 −829 node_modules/eventemitter2/test/wildcardEvents/all.js
  16. +0 −216 node_modules/eventemitter2/test/wildcardEvents/customDelimiter.js
  17. +0 −56 node_modules/eventemitter2/test/wildcardEvents/k1.js
  18. +0 −79 node_modules/eventemitter2/test/wildcardEvents/options.js
  19. +0 −284 node_modules/eventemitter2/test/wildcardEvents/removeListener.js
  20. +0 −196 node_modules/eventemitter2/test/wildcardEvents/ttl.js
  21. +0 −9 node_modules/hiredis/.lock-wscript
  22. +0 −16 node_modules/hiredis/Makefile
  23. 0 node_modules/hiredis/README
  24. +0 −121 node_modules/hiredis/bench.js
  25. BIN node_modules/hiredis/build/.wafpickle-7
  26. +0 −2 node_modules/hiredis/build/c4che/build.config.py
  27. +0 −50 node_modules/hiredis/build/c4che/default.cache.py
  28. +0 −44 node_modules/hiredis/build/config.log
  29. BIN node_modules/hiredis/build/default/hiredis.node
  30. BIN node_modules/hiredis/build/default/hiredis_1.o
  31. BIN node_modules/hiredis/build/default/reader_1.o
  32. +0 −16 node_modules/hiredis/deps/hiredis/CHANGELOG.md
  33. +0 −29 node_modules/hiredis/deps/hiredis/COPYING
  34. +0 −148 node_modules/hiredis/deps/hiredis/Makefile
  35. +0 −352 node_modules/hiredis/deps/hiredis/README.md
  36. +0 −97 node_modules/hiredis/deps/hiredis/adapters/ae.h
  37. +0 −117 node_modules/hiredis/deps/hiredis/adapters/libev.h
  38. +0 −78 node_modules/hiredis/deps/hiredis/adapters/libevent.h
  39. +0 −604 node_modules/hiredis/deps/hiredis/async.c
  40. +0 −125 node_modules/hiredis/deps/hiredis/async.h
  41. BIN node_modules/hiredis/deps/hiredis/async.o
  42. +0 −338 node_modules/hiredis/deps/hiredis/dict.c
  43. +0 −126 node_modules/hiredis/deps/hiredis/dict.h
  44. +0 −56 node_modules/hiredis/deps/hiredis/example-ae.c
  45. +0 −51 node_modules/hiredis/deps/hiredis/example-libev.c
  46. +0 −52 node_modules/hiredis/deps/hiredis/example-libevent.c
  47. +0 −68 node_modules/hiredis/deps/hiredis/example.c
  48. +0 −16 node_modules/hiredis/deps/hiredis/fmacros.h
  49. +0 −1,284 node_modules/hiredis/deps/hiredis/hiredis.c
  50. +0 −204 node_modules/hiredis/deps/hiredis/hiredis.h
  51. BIN node_modules/hiredis/deps/hiredis/hiredis.o
  52. BIN node_modules/hiredis/deps/hiredis/libhiredis.a
  53. +0 −279 node_modules/hiredis/deps/hiredis/net.c
  54. +0 −47 node_modules/hiredis/deps/hiredis/net.h
  55. BIN node_modules/hiredis/deps/hiredis/net.o
  56. +0 −605 node_modules/hiredis/deps/hiredis/sds.c
  57. +0 −88 node_modules/hiredis/deps/hiredis/sds.h
  58. BIN node_modules/hiredis/deps/hiredis/sds.o
  59. +0 −654 node_modules/hiredis/deps/hiredis/test.c
  60. +0 −14 node_modules/hiredis/hiredis.cc
  61. +0 −39 node_modules/hiredis/hiredis.js
  62. +0 −18 node_modules/hiredis/package.json
  63. +0 −37 node_modules/hiredis/parser_bench.js
  64. +0 −238 node_modules/hiredis/reader.cc
  65. +0 −55 node_modules/hiredis/reader.h
  66. +0 −172 node_modules/hiredis/test/reader.js
  67. +0 −15 node_modules/hiredis/wscript
  68. +0 −9 node_modules/mdns/.lock-wscript
  69. +0 −1 node_modules/mdns/.npmignore
  70. +0 −37 node_modules/mdns/CHANGES
  71. +0 −23 node_modules/mdns/LICENSE
  72. +0 −42 node_modules/mdns/Makefile
  73. +0 −67 node_modules/mdns/README.textile
  74. +0 −35 node_modules/mdns/configure
  75. +0 −18 node_modules/mdns/examples/express_app.js
  76. +0 −92 node_modules/mdns/lib/advertisement.js
  77. +0 −99 node_modules/mdns/lib/browser.js
  78. +0 −1 node_modules/mdns/lib/dns_sd.node
  79. +0 −26 node_modules/mdns/lib/mdns.js
  80. +0 −40 node_modules/mdns/lib/mdns_service.js
  81. +0 −47 node_modules/mdns/lib/mdns_test.js
  82. +0 −193 node_modules/mdns/lib/resolver_sequence_tasks.js
  83. +0 −195 node_modules/mdns/lib/service_type.js
  84. +0 −30 node_modules/mdns/module.gyp
  85. +0 −7 node_modules/mdns/out/.conf_check_0/test.cpp
  86. BIN node_modules/mdns/out/.conf_check_0/testbuild/.wafpickle-7
  87. BIN node_modules/mdns/out/.conf_check_0/testbuild/default/test_1.o
  88. BIN node_modules/mdns/out/.conf_check_0/testbuild/default/testprog
  89. BIN node_modules/mdns/out/.wafpickle-7
  90. +0 −2 node_modules/mdns/out/c4che/build.config.py
  91. +0 −52 node_modules/mdns/out/c4che/default.cache.py
  92. +0 −91 node_modules/mdns/out/config.log
  93. BIN node_modules/mdns/out/default/demangle.node
  94. BIN node_modules/mdns/out/default/dns_sd.node
  95. BIN node_modules/mdns/out/default/src/demangle_2.o
  96. BIN node_modules/mdns/out/default/src/dns_sd_1.o
  97. BIN node_modules/mdns/out/default/src/dns_service_browse_1.o
  98. BIN node_modules/mdns/out/default/src/dns_service_enumerate_domains_1.o
  99. BIN node_modules/mdns/out/default/src/dns_service_get_addr_info_1.o
  100. BIN node_modules/mdns/out/default/src/dns_service_process_result_1.o
  101. BIN node_modules/mdns/out/default/src/dns_service_ref_1.o
  102. BIN node_modules/mdns/out/default/src/dns_service_ref_deallocate_1.o
  103. BIN node_modules/mdns/out/default/src/dns_service_ref_sock_fd_1.o
  104. BIN node_modules/mdns/out/default/src/dns_service_register_1.o
  105. BIN node_modules/mdns/out/default/src/dns_service_resolve_1.o
  106. BIN node_modules/mdns/out/default/src/mdns_utils_1.o
  107. BIN node_modules/mdns/out/default/src/txt_record_buffer_to_object_1.o
  108. BIN node_modules/mdns/out/default/src/txt_record_create_1.o
  109. BIN node_modules/mdns/out/default/src/txt_record_deallocate_1.o
  110. BIN node_modules/mdns/out/default/src/txt_record_get_length_1.o
  111. BIN node_modules/mdns/out/default/src/txt_record_ref_1.o
  112. BIN node_modules/mdns/out/default/src/txt_record_set_value_1.o
  113. +0 −53 node_modules/mdns/package.json
  114. +0 −31 node_modules/mdns/src/demangle.cpp
  115. +0 −287 node_modules/mdns/src/dns_sd.cpp
  116. +0 −103 node_modules/mdns/src/dns_service_browse.cpp
  117. +0 −78 node_modules/mdns/src/dns_service_enumerate_domains.cpp
  118. +0 −126 node_modules/mdns/src/dns_service_get_addr_info.cpp
  119. +0 −30 node_modules/mdns/src/dns_service_process_result.cpp
  120. +0 −126 node_modules/mdns/src/dns_service_ref.cpp
  121. +0 −53 node_modules/mdns/src/dns_service_ref.hpp
  122. +0 −31 node_modules/mdns/src/dns_service_ref_deallocate.cpp
  123. +0 −32 node_modules/mdns/src/dns_service_ref_sock_fd.cpp
  124. +0 −165 node_modules/mdns/src/dns_service_register.cpp
  125. +0 −110 node_modules/mdns/src/dns_service_resolve.cpp
  126. +0 −112 node_modules/mdns/src/mdns_utils.cpp
  127. +0 −61 node_modules/mdns/src/mdns_utils.hpp
  128. +0 −11 node_modules/mdns/src/skeleton.cpp_
  129. +0 −51 node_modules/mdns/src/txt_record_buffer_to_object.cpp
  130. +0 −38 node_modules/mdns/src/txt_record_create.cpp
  131. +0 −26 node_modules/mdns/src/txt_record_deallocate.cpp
  132. +0 −25 node_modules/mdns/src/txt_record_get_length.cpp
  133. +0 −37 node_modules/mdns/src/txt_record_ref.cpp
  134. +0 −35 node_modules/mdns/src/txt_record_ref.hpp
  135. +0 −53 node_modules/mdns/src/txt_record_set_value.cpp
  136. +0 −930 node_modules/mdns/tests/test_dns_sd.js
  137. +0 −351 node_modules/mdns/tests/test_functional.js
  138. +0 −26 node_modules/mdns/tests/test_odd_ends.js
  139. +0 −100 node_modules/mdns/tests/test_service_type.js
  140. +0 −29 node_modules/mdns/utils/coverage
  141. +0 −124 node_modules/mdns/utils/docpack
  142. +0 −63 node_modules/mdns/utils/lib/actors.js
  143. +0 −12 node_modules/mdns/utils/lib/bunch.js
  144. +0 −70 node_modules/mdns/utils/lib/compiler.js
  145. +0 −1 node_modules/mdns/utils/lib/demangle.node
  146. +0 −127 node_modules/mdns/utils/lib/lcov.js
  147. +0 −12 node_modules/mdns/utils/lib/obj.js
  148. +0 −50 node_modules/mdns/utils/lib/view.js
  149. +0 −191 node_modules/mdns/utils/ncov
  150. +0 −116 node_modules/mdns/utils/render_report
  151. +0 −267 node_modules/mdns/utils/testrun
  152. +0 −99 node_modules/mdns/wscript
  153. +0 −567 node_modules/redis/README.md
  154. +0 −210 node_modules/redis/changelog.md
  155. +0 −5 node_modules/redis/examples/auth.js
  156. +0 −33 node_modules/redis/examples/backpressure_drain.js
  157. +0 −9 node_modules/redis/examples/eval.js
  158. +0 −24 node_modules/redis/examples/extend.js
  159. +0 −32 node_modules/redis/examples/file.js
  160. +0 −5 node_modules/redis/examples/mget.js
  161. +0 −10 node_modules/redis/examples/monitor.js
  162. +0 −46 node_modules/redis/examples/multi.js
  163. +0 −29 node_modules/redis/examples/multi2.js
  164. +0 −33 node_modules/redis/examples/psubscribe.js
  165. +0 −41 node_modules/redis/examples/pub_sub.js
  166. +0 −24 node_modules/redis/examples/simple.js
  167. +0 −17 node_modules/redis/examples/sort.js
  168. +0 −15 node_modules/redis/examples/subqueries.js
  169. +0 −19 node_modules/redis/examples/subquery.js
  170. +0 −29 node_modules/redis/examples/unix_socket.js
  171. +0 −31 node_modules/redis/examples/web_server.js
  172. +0 −39 node_modules/redis/generate_commands.js
  173. +0 −955 node_modules/redis/index.js
  174. +0 −126 node_modules/redis/lib/commands.js
  175. +0 −46 node_modules/redis/lib/parser/hiredis.js
  176. +0 −317 node_modules/redis/lib/parser/javascript.js
  177. +0 −58 node_modules/redis/lib/queue.js
  178. +0 −12 node_modules/redis/lib/to_array.js
  179. +0 −7 node_modules/redis/lib/util.js
  180. +0 −225 node_modules/redis/multi_bench.js
  181. +0 −29 node_modules/redis/package.json
  182. +0 −1,301 node_modules/redis/test.js
  183. +0 −89 node_modules/redis/tests/buffer_bench.js
  184. +0 −38 node_modules/redis/tests/hiredis_parser.js
  185. +0 −29 node_modules/redis/tests/reconnect_test.js
  186. +0 −16 node_modules/redis/tests/stress/codec.js
  187. +0 −38 node_modules/redis/tests/stress/pubsub/pub.js
  188. +0 −10 node_modules/redis/tests/stress/pubsub/run
Sorry, we could not display the entire diff because it was too big.
View
1 .gitignore
@@ -0,0 +1 @@
+node_modules
View
13 node_modules/eventemitter2/.npmignore
@@ -1,13 +0,0 @@
-#ignore these files
-*.swp
-*~
-*.lock
-*.DS_Store
-node_modules
-npm-debug.log
-*.out
-*.o
-*.tmp
-
-
-
View
202 node_modules/eventemitter2/README.md
@@ -1,202 +0,0 @@
-# EventEmitter2
-
-EventEmitter2 is a an implementation of the EventEmitter found in Node.js
-
-## Features
-
- - Namespaces/Wildcards.
- - Times To Listen (TTL), extends the `once` concept with `many`.
- - Browser environment compatibility.
- - ~2x faster than Node.js event emitter for non-namespaced events.
-
-## Differences (Non breaking, compatible with existing EventEmitter)
-
- - The constructor takes a configuration object.
-
-```javascript
- var server = EventEmitter2({
- wildcard: true, // should the event emitter use wildcards.
- delimiter: '::', // the delimiter used to segment namespaces, defaults to `.`.
- maxListeners: 20, // the max number of listeners that can be assigned to an event, defaults to 10.
- });
-```
-
- - Getting the actual event that fired.
-
-```javascript
- server.on('foo.*', function(value1, value2) {
- console.log(this.event, value1, value2);
- });
-```
-
- - Fire an event N times and then remove it, an extension of the `once` concept.
-
-```javascript
- server.many('foo', 4, function() {
- console.log('hello');
- });
-```
-
- - Pass in a namespaced event as an array rather than a delimited string.
-
-```javascript
- server.many(['foo', 'bar', 'bazz'], function() {
- console.log('hello');
- });
-```
-
-
-## API
-
-When an `EventEmitter` instance experiences an error, the typical action is
-to emit an `error` event. Error events are treated as a special case.
-If there is no listener for it, then the default action is to print a stack
-trace and exit the program.
-
-All EventEmitters emit the event `newListener` when new listeners are
-added.
-
-
-**Namespaces** with **Wildcards**
-To use namespaces/wildcards, pass the `wildcard` option into the EventEmitter constructor.
-When namespaces/wildcards are enabled, events can either be strings (`foo.bar`) separated
-by a delimiter or arrays (`['foo', 'bar']`). The delimiter is also configurable as a
-constructor option.
-
-An event name passed to any event emitter method can contain a wild card (the `*` character).
-If the event name is a string, a wildcard may appear as `foo.*`. If the event name is an array,
-the wildcard may appear as `['foo', '*']`.
-
-If either of the above described events were passed to the `on` method, subsequent emits such
-as the following would be observed...
-
-```javascript
- emitter.emit(['foo.bazz']);
- emitter.emit(['foo', 'bar']);
-```
-
-
-#### emitter.addListener(event, listener)
-#### emitter.on(event, listener)
-
-Adds a listener to the end of the listeners array for the specified event.
-
-```javascript
- server.on('data', function(value1, value2, value3 /* accepts any number of expected values... */) {
- console.log('The event was raised!');
- });
-```
-
-```javascript
- server.on('data', function(value) {
- console.log('This event will be listened to exactly four times.');
- });
-```
-
-#### emitter.onAny(listener)
-
-Adds a listener that will be fired when any event is emitted.
-
-```javascript
- server.onAny(function(value) {
- console.log('This event will be listened to exactly four times.');
- });
-```
-
-#### emitter.offAny(listener)
-
-Removes the listener that will be fired when any event is emitted.
-
-```javascript
- server.offAny(function(value) {
- console.log('This event will be listened to exactly four times.');
- });
-```
-
-#### emitter.once(event, listener)
-
-Adds a **one time** listener for the event. The listener is invoked only the first time the event is fired, after which it is removed.
-
-```javascript
- server.once('get', function (value) {
- console.log('Ah, we have our first value!');
- });
-```
-
-#### emitter.many(event, timesToListen, listener)
-
-Adds a listener that will execute **n times** for the event before being removed. The listener is invoked only the first time the event is fired, after which it is removed.
-
-```javascript
- server.many('get', 4, function (value) {
- console.log('Ah, we have our first value!');
- });
-```
-
-
-#### emitter.removeListener(event, listener)
-#### emitter.off(event, listener)
-
-Remove a listener from the listener array for the specified event. **Caution**: changes array indices in the listener array behind the listener.
-
-```javascript
- var callback = function(value) {
- console.log('someone connected!');
- };
- server.on('get', callback);
- // ...
- server.removeListener('get', callback);
-```
-
-
-#### emitter.removeAllListeners([event])
-
-Removes all listeners, or those of the specified event.
-
-
-#### emitter.setMaxListeners(n)
-
-By default EventEmitters will print a warning if more than 10 listeners are added to it. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that to be increased. Set to zero for unlimited.
-
-
-#### emitter.listeners(event)
-
-Returns an array of listeners for the specified event. This array can be manipulated, e.g. to remove listeners.
-
-```javascript
- server.on('get', function(value) {
- console.log('someone connected!');
- });
- console.log(console.log(server.listeners('get')); // [ [Function] ]
-```
-
-#### emitter.listenersAny(event)
-
-Returns an array of listeners that are listening for any event that is specified. This array can be manipulated, e.g. to remove listeners.
-
-```javascript
- server.onAny(function(value) {
- console.log('someone connected!');
- });
- console.log(console.log(server.listenersAny()[0]); // [ [Function] ] // someone connected!
-```
-
-#### emitter.emit(event, [arg1], [arg2], [...])
-
-Execute each of the listeners that may be listening for the specified event name in order with the list of arguments.
-
-## Test coverage
-
-There is a test suite that tries to cover each use case, it can be found <a href="https://github.com/hij1nx/EventEmitter2/tree/master/test">here</a>.
-
-## Licence
-
-(The MIT License)
-
-Copyright (c) 2011 hij1nx <http://www.twitter.com/hij1nx>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
1 node_modules/eventemitter2/index.js
@@ -1 +0,0 @@
-module.exports = require('./lib/eventemitter2');
View
547 node_modules/eventemitter2/lib/eventemitter2.js
@@ -1,547 +0,0 @@
-;!function(exports, undefined) {
-
- var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {
- return Object.prototype.toString.call(obj) === "[object Array]";
- };
- var defaultMaxListeners = 10;
-
- function init() {
- this._events = new Object;
- }
-
- function configure(conf) {
- if (conf) {
- conf.delimiter && (this.delimiter = conf.delimiter);
- conf.wildcard && (this.wildcard = conf.wildcard);
- if (this.wildcard) {
- this.listenerTree = new Object;
- }
- }
- }
-
- function EventEmitter(conf) {
- this._events = new Object;
- configure.call(this, conf);
- }
-
- //
- // Attention, function return type now is array, always !
- // It has zero elements if no any matches found and one or more
- // elements (leafs) if there are matches
- //
- function searchListenerTree(handlers, type, tree, i) {
- if (!tree) {
- return [];
- }
- var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,
- typeLength = type.length, currentType = type[i], nextType = type[i+1];
- if (i === typeLength && tree._listeners) {
- //
- // If at the end of the event(s) list and the tree has listeners
- // invoke those listeners.
- //
- if (typeof tree._listeners === 'function') {
- handlers && handlers.push(tree._listeners);
- return [tree];
- } else {
- for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {
- handlers && handlers.push(tree._listeners[leaf]);
- }
- return [tree];
- }
- }
-
- if ((currentType === '*' || currentType === '**') || tree[currentType]) {
- //
- // If the event emitted is '*' at this part
- // or there is a concrete match at this patch
- //
- if (currentType === '*') {
- for (branch in tree) {
- if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
- listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1));
- }
- }
- return listeners;
- } else if(currentType === '**') {
- endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*'));
- if(endReached && tree._listeners) {
- // The next element has a _listeners, add it to the handlers.
- listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength));
- }
-
- for (branch in tree) {
- if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
- if(branch === '*' || branch === '**') {
- if(tree[branch]._listeners && !endReached) {
- listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength));
- }
- listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
- } else if(branch === nextType) {
- listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2));
- } else {
- // No match on this one, shift into the tree but not in the type array.
- listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
- }
- }
- }
- return listeners;
- }
-
- listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1));
- }
-
- xTree = tree['*'];
- if (xTree) {
- //
- // If the listener tree will allow any match for this part,
- // then recursively explore all branches of the tree
- //
- searchListenerTree(handlers, type, xTree, i+1);
- }
-
- xxTree = tree['**'];
- if(xxTree) {
- if(i < typeLength) {
- if(xxTree._listeners) {
- // If we have a listener on a '**', it will catch all, so add its handler.
- searchListenerTree(handlers, type, xxTree, typeLength);
- }
-
- // Build arrays of matching next branches and others.
- for(branch in xxTree) {
- if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) {
- if(branch === nextType) {
- // We know the next element will match, so jump twice.
- searchListenerTree(handlers, type, xxTree[branch], i+2);
- } else if(branch === currentType) {
- // Current node matches, move into the tree.
- searchListenerTree(handlers, type, xxTree[branch], i+1);
- } else {
- isolatedBranch = {};
- isolatedBranch[branch] = xxTree[branch];
- searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1);
- }
- }
- }
- } else if(xxTree._listeners) {
- // We have reached the end and still on a '**'
- searchListenerTree(handlers, type, xxTree, typeLength);
- } else if(xxTree['*'] && xxTree['*']._listeners) {
- searchListenerTree(handlers, type, xxTree['*'], typeLength);
- }
- }
-
- return listeners;
- }
-
- function growListenerTree(type, listener) {
-
- type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
-
- //
- // Looks for too consecutive '**', if so, don't add the event at all.
- //
- for(var i = 0, len = type.length; i+1 < len; i++) {
- if(type[i] === '**' && type[i+1] === '**') {
- return;
- }
- }
-
- var tree = this.listenerTree;
- var name = type.shift();
-
- while (name) {
-
- if (!tree[name]) {
- tree[name] = new Object;
- }
-
- tree = tree[name];
-
- if (type.length === 0) {
-
- if (!tree._listeners) {
- tree._listeners = listener;
- }
- else if(typeof tree._listeners === 'function') {
- tree._listeners = [tree._listeners, listener];
- }
- else if (isArray(tree._listeners)) {
-
- tree._listeners.push(listener);
-
- if (!tree._listeners.warned) {
-
- var m = defaultMaxListeners;
-
- if (typeof this._events.maxListeners !== 'undefined') {
- m = this._events.maxListeners;
- }
-
- if (m > 0 && tree._listeners.length > m) {
-
- tree._listeners.warned = true;
- console.error('(node) warning: possible EventEmitter memory ' +
- 'leak detected. %d listeners added. ' +
- 'Use emitter.setMaxListeners() to increase limit.',
- tree._listeners.length);
- console.trace();
- }
- }
- }
- return true;
- }
- name = type.shift();
- }
- return true;
- };
-
- // By default EventEmitters will print a warning if more than
- // 10 listeners are added to it. This is a useful default which
- // helps finding memory leaks.
- //
- // Obviously not all Emitters should be limited to 10. This function allows
- // that to be increased. Set to zero for unlimited.
-
- EventEmitter.prototype.delimiter = '.';
-
- EventEmitter.prototype.setMaxListeners = function(n) {
- this._events || init.call(this);
- this._events.maxListeners = n;
- };
-
- EventEmitter.prototype.event = '';
-
- EventEmitter.prototype.once = function(event, fn) {
- this.many(event, 1, fn);
- return this;
- };
-
- EventEmitter.prototype.many = function(event, ttl, fn) {
- var self = this;
-
- if (typeof fn !== 'function') {
- throw new Error('many only accepts instances of Function');
- }
-
- function listener() {
- if (--ttl === 0) {
- self.off(event, listener);
- }
- fn.apply(this, arguments);
- };
-
- listener._origin = fn;
-
- this.on(event, listener);
-
- return self;
- };
-
- EventEmitter.prototype.emit = function() {
- this._events || init.call(this);
-
- var type = arguments[0];
-
- if (type === 'newListener') {
- if (!this._events.newListener) { return false; }
- }
-
- // Loop through the *_all* functions and invoke them.
- if (this._all) {
- var l = arguments.length;
- var args = new Array(l - 1);
- for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
- for (i = 0, l = this._all.length; i < l; i++) {
- this.event = type;
- this._all[i].apply(this, args);
- }
- }
-
- // If there is no 'error' event listener then throw.
- if (type === 'error') {
-
- if (!this._all &&
- !this._events.error &&
- !(this.wildcard && this.listenerTree.error)) {
-
- if (arguments[1] instanceof Error) {
- throw arguments[1]; // Unhandled 'error' event
- } else {
- throw new Error("Uncaught, unspecified 'error' event.");
- }
- return false;
- }
- }
-
- var handler;
-
- if(this.wildcard) {
- handler = [];
- var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
- searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
- }
- else {
- handler = this._events[type];
- }
-
- if (typeof handler === 'function') {
- this.event = type;
- if (arguments.length === 1) {
- handler.call(this);
- }
- else if (arguments.length > 1)
- switch (arguments.length) {
- case 2:
- handler.call(this, arguments[1]);
- break;
- case 3:
- handler.call(this, arguments[1], arguments[2]);
- break;
- // slower
- default:
- var l = arguments.length;
- var args = new Array(l - 1);
- for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
- handler.apply(this, args);
- }
- return true;
- }
- else if (handler) {
- var l = arguments.length;
- var args = new Array(l - 1);
- for (var i = 1; i < l; i++) args[i - 1] = arguments[i];
-
- var listeners = handler.slice();
- for (var i = 0, l = listeners.length; i < l; i++) {
- this.event = type;
- listeners[i].apply(this, args);
- }
- return true;
- }
- else {
- return false;
- }
-
- };
-
- EventEmitter.prototype.on = function(type, listener) {
-
- if (typeof type === 'function') {
- this.onAny(type);
- return this;
- }
-
- if (typeof listener !== 'function') {
- throw new Error('on only accepts instances of Function');
- }
- this._events || init.call(this);
-
- // To avoid recursion in the case that type == "newListeners"! Before
- // adding it to the listeners, first emit "newListeners".
- this.emit('newListener', type, listener);
-
- if(this.wildcard) {
- growListenerTree.call(this, type, listener);
- return this;
- }
-
- if (!this._events[type]) {
- // Optimize the case of one listener. Don't need the extra array object.
- this._events[type] = listener;
- }
- else if(typeof this._events[type] === 'function') {
- // Adding the second element, need to change to array.
- this._events[type] = [this._events[type], listener];
- }
- else if (isArray(this._events[type])) {
- // If we've already got an array, just append.
- this._events[type].push(listener);
-
- // Check for listener leak
- if (!this._events[type].warned) {
-
- var m = defaultMaxListeners;
-
- if (typeof this._events.maxListeners !== 'undefined') {
- m = this._events.maxListeners;
- }
-
- if (m > 0 && this._events[type].length > m) {
-
- this._events[type].warned = true;
- console.error('(node) warning: possible EventEmitter memory ' +
- 'leak detected. %d listeners added. ' +
- 'Use emitter.setMaxListeners() to increase limit.',
- this._events[type].length);
- console.trace();
- }
- }
- }
- return this;
- };
-
- EventEmitter.prototype.onAny = function(fn) {
-
- if(!this._all) {
- this._all = [];
- }
-
- if (typeof fn !== 'function') {
- throw new Error('onAny only accepts instances of Function');
- }
-
- // Add the function to the event listener collection.
- this._all.push(fn);
- return this;
- };
-
- EventEmitter.prototype.addListener = EventEmitter.prototype.on;
-
- EventEmitter.prototype.off = function(type, listener) {
- if (typeof listener !== 'function') {
- throw new Error('removeListener only takes instances of Function');
- }
-
- var handlers,leafs=[];
-
- if(this.wildcard) {
- var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
- leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
- }
- else {
- // does not use listeners(), so no side effect of creating _events[type]
- if (!this._events[type]) return this;
- handlers = this._events[type];
- leafs.push({_listeners:handlers});
- }
-
- for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
- var leaf = leafs[iLeaf];
- handlers = leaf._listeners;
- if (isArray(handlers)) {
-
- var position = -1;
-
- for (var i = 0, length = handlers.length; i < length; i++) {
- if (handlers[i] === listener ||
- (handlers[i].listener && handlers[i].listener === listener) ||
- (handlers[i]._origin && handlers[i]._origin === listener)) {
- position = i;
- break;
- }
- }
-
- if (position < 0) {
- return this;
- }
-
- if(this.wildcard) {
- leaf._listeners.splice(position, 1)
- }
- else {
- this._events[type].splice(position, 1);
- }
-
- if (handlers.length === 0) {
- if(this.wildcard) {
- delete leaf._listeners;
- }
- else {
- delete this._events[type];
- }
- }
- }
- else if (handlers === listener ||
- (handlers.listener && handlers.listener === listener) ||
- (handlers._origin && handlers._origin === listener)) {
- if(this.wildcard) {
- delete leaf._listeners;
- }
- else {
- delete this._events[type];
- }
- }
- }
-
- return this;
- };
-
- EventEmitter.prototype.offAny = function(fn) {
- var i = 0, l = 0, fns;
- if (fn && this._all && this._all.length > 0) {
- fns = this._all;
- for(i = 0, l = fns.length; i < l; i++) {
- if(fn === fns[i]) {
- fns.splice(i, 1);
- return this;
- }
- }
- } else {
- this._all = [];
- }
- return this;
- };
-
- EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
-
- EventEmitter.prototype.removeAllListeners = function(type) {
- if (arguments.length === 0) {
- !this._events || init.call(this);
- return this;
- }
-
- if(this.wildcard) {
- var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
- var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
-
- for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
- var leaf = leafs[iLeaf];
- leaf._listeners = null;
- }
- }
- else {
- if (!this._events[type]) return this;
- this._events[type] = null;
- }
- return this;
- };
-
- EventEmitter.prototype.listeners = function(type) {
- if(this.wildcard) {
- var handlers = [];
- var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
- searchListenerTree.call(this, handlers, ns, this.listenerTree, 0);
- return handlers;
- }
-
- this._events || init.call(this);
-
- if (!this._events[type]) this._events[type] = [];
- if (!isArray(this._events[type])) {
- this._events[type] = [this._events[type]];
- }
- return this._events[type];
- };
-
- EventEmitter.prototype.listenersAny = function() {
-
- if(this._all) {
- return this._all;
- }
- else {
- return [];
- }
-
- };
-
- if (typeof define === 'function' && define.amd) {
- define(function() {
- return EventEmitter;
- });
- } else {
- exports.EventEmitter2 = EventEmitter;
- }
-
-}(typeof process !== 'undefined' && process.title ? exports : window);
View
33 node_modules/eventemitter2/package.json
@@ -1,33 +0,0 @@
-{
- "name": "eventemitter2",
- "version": "0.4.8",
- "description": "A Node.js event emitter implementation with namespaces, wildcards, TTL and browser support.",
- "keywords": ["event", "events", "emitter", "eventemitter"],
- "author": "hij1nx <hij1nx@nodejitsu.com> http://twitter.com/hij1nx",
- "maintainers": [
- "hij1nx <hij1nx@nodejitsu.com>",
- "jameson <jameson@nodejitsu.com>"
- ],
- "contributors": [
- "Charlie Robbins <charlie@nodejitsu.com> http://twitter.com/indexzero",
- "Jameson Lee <jameson@nodejitsu.com> http://twitter.com/Jamesonjlee",
- "Jeroen van Duffelen <jvduf@nodejitsu.com> http://www.twitter.com/jvduf",
- "Fedor Indutny <fedor.indutny@gmail.com> http://www.twitter.com/indutny"
- ],
- "licenses": [{"type": "MIT"}],
- "homepage": "https://github.com/hij1nx/EventEmitter2",
- "repositories": [{
- "type": "git",
- "url": "git://github.com/hij1nx/EventEmitter2.git"
- }],
- "devDependencies": {
- "nodeunit": "*",
- "benchmark" : ">= 0.2.2"
- },
- "engines": ["node"],
- "main": "./lib/eventemitter2.js",
- "scripts" : {
- "test" : "nodeunit test/simple/* && nodeunit test/wildcardEvents/*",
- "benchmark" : "node test/perf/benchmark.js"
- }
-}
View
123 node_modules/eventemitter2/test/common.js
@@ -1,123 +0,0 @@
-// Copyright Joyent, Inc. and other Node contributors.
-//
-// Permission is hereby granted, free of charge, to any person obtaining a
-// copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to permit
-// persons to whom the Software is furnished to do so, subject to the
-// following conditions:
-//
-// The above copyright notice and this permission notice shall be included
-// in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
-// USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-var path = require('path');
-var assert = require('assert');
-
-exports.testDir = path.dirname(__filename);
-exports.fixturesDir = path.join(exports.testDir, 'fixtures');
-exports.libDir = path.join(exports.testDir, '../lib');
-exports.tmpDir = path.join(exports.testDir, 'tmp');
-exports.PORT = 12346;
-
-if (process.platform == 'win32') {
- exports.PIPE = '\\\\.\\pipe\\libuv-test';
-} else {
- exports.PIPE = exports.tmpDir + '/test.sock';
-}
-
-var util = require('util');
-for (var i in util) exports[i] = util[i];
-//for (var i in exports) global[i] = exports[i];
-
-function protoCtrChain(o) {
- var result = [];
- for (; o; o = o.__proto__) { result.push(o.constructor); }
- return result.join();
-}
-
-exports.indirectInstanceOf = function(obj, cls) {
- if (obj instanceof cls) { return true; }
- var clsChain = protoCtrChain(cls.prototype);
- var objChain = protoCtrChain(obj);
- return objChain.slice(-clsChain.length) === clsChain;
-};
-
-
-// Turn this off if the test should not check for global leaks.
-exports.globalCheck = true;
-
-process.on('exit', function() {
- if (!exports.globalCheck) return;
- var knownGlobals = [setTimeout,
- setInterval,
- clearTimeout,
- clearInterval,
- console,
- Buffer,
- process,
- global.ArrayBuffer!==undefined?ArrayBuffer:null,
- global.Int8Array!==undefined?Int8Array:null,
- global.Uint8Array!==undefined?Uint8Array:null,
- global.Int16Array!==undefined?Int16Array:null,
- global.Uint16Array!==undefined?Uint16Array:null,
- global.Int32Array!==undefined?Int32Array:null,
- global.Uint32Array!==undefined?Uint32Array:null,
- global.Float32Array!==undefined?Float32Array:null,
- global.Float64Array!==undefined?Float64Array:null,
- global.DataView!==undefined?DataView:null,
- AssertionError,
- global,
- events
- ];
-
- if (global.errno) {
- knownGlobals.push(errno);
- }
-
- if (global.gc) {
- knownGlobals.push(gc);
- }
-
- if (global.DTRACE_HTTP_SERVER_RESPONSE) {
- knownGlobals.push(DTRACE_HTTP_SERVER_RESPONSE);
- knownGlobals.push(DTRACE_HTTP_SERVER_REQUEST);
- knownGlobals.push(DTRACE_HTTP_CLIENT_RESPONSE);
- knownGlobals.push(DTRACE_HTTP_CLIENT_REQUEST);
- knownGlobals.push(DTRACE_NET_STREAM_END);
- knownGlobals.push(DTRACE_NET_SERVER_CONNECTION);
- knownGlobals.push(DTRACE_NET_SOCKET_READ);
- knownGlobals.push(DTRACE_NET_SOCKET_WRITE);
- }
-
- for (var x in global) {
- var found = false;
-
- for (var y in knownGlobals) {
- if (global[x] === knownGlobals[y]) {
- found = true;
- break;
- }
- }
-
- if (!found) {
- console.error('Unknown global: %s', x);
- assert.ok(false, 'Unknown global founded');
- }
- }
-});
-
-
-// This function allows one two run an HTTP test agaist both HTTPS and
-// normal HTTP modules. This ensures they fit the same API.
-exports.httpTest = function httpTest(cb) {
-};
-
View
53 node_modules/eventemitter2/test/perf/benchmark.js
@@ -1,53 +0,0 @@
-
-var Benchmark = require('benchmark');
-var suite = new Benchmark.Suite();
-
-var EventEmitter = require('events').EventEmitter;
-var emitter = new EventEmitter;
-
-var EventEmitter2 = require('../../lib/eventemitter2').EventEmitter2;
-var emitter2 = new EventEmitter2;
-
-var EventEmitter3 = require('events').EventEmitter;
-var emitter3 = new EventEmitter3;
-
-suite
-
- .add('EventEmitterHeatUp', function() {
-
- emitter3.on('test3', function () { 1==1; });
- emitter3.emit('test3');
- emitter3.removeAllListeners('test3');
-
- })
- .add('EventEmitter', function() {
-
- emitter.on('test1', function () { 1==1; });
- emitter.emit('test1');
- emitter.removeAllListeners('test1');
-
- })
- .add('EventEmitter2', function() {
-
- emitter2.on('test2', function () { 1==1; });
- emitter2.emit('test2');
- emitter2.removeAllListeners('test2');
-
- })
-
- .add('EventEmitter2 (wild)', function() {
-
- emitter2.on('test2.foo', function () { 1==1; });
- emitter2.emit('test2.foo');
- emitter2.removeAllListeners('test2.foo');
-
- })
-
- .on('cycle', function(event, bench) {
- console.log(String(bench));
- })
- .on('complete', function() {
- console.log('Fastest is ' + this.filter('fastest').pluck('name'));
- })
-
- .run(true);
View
192 node_modules/eventemitter2/test/simple/addListener.js
@@ -1,192 +0,0 @@
-var simpleEvents = require('nodeunit').testCase;
-
-var file = '../../lib/eventemitter2';
-
-module.exports = simpleEvents({
-
- setUp: function (callback) {
- var EventEmitter2;
-
- if(typeof require !== 'undefined') {
- EventEmitter2 = require(file).EventEmitter2;
- }
- else {
- EventEmitter2 = window.EventEmitter2;
- }
-
- this.emitter = new EventEmitter2({ verbose: true });
- callback();
- },
-
- tearDown: function (callback) {
- //clean up?
- callback();
- },
-
- '1. Add a single listener on a single event.': function (test) {
-
- var emitter = this.emitter;
-
- emitter.on('test1', function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners('test1').length, 1, 'There are three emitters');
-
- test.expect(1);
- test.done();
-
- },
- '2. Add two listeners on a single event.': function (test) {
-
- var emitter = this.emitter;
-
- emitter.on('test1', function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on('test1', function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners('test1').length, 2, 'There are three emitters');
-
- test.expect(1);
- test.done();
-
- },
- '3. Add three listeners on a single event.': function (test) {
-
- var emitter = this.emitter;
-
- emitter.on('test1', function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on('test1', function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on('test1', function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners('test1').length, 3, 'There are three emitters');
-
- test.expect(1);
- test.done();
-
- },
- '4. Add two listeners to two different events.': function (test) {
-
- var emitter = this.emitter;
-
- emitter.on('test1', function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on('test1', function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on('test2', function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on('test2', function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners('test1').length, 2, 'There are two emitters');
- test.equal(emitter.listeners('test2').length, 2, 'There are two emitters');
-
- test.expect(2);
- test.done();
-
- },
- '5. Never adding any listeners should yield a listeners array with the length of 0.': function (test) {
-
- var emitter = this.emitter;
-
- emitter.on('test1', function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners('test2').length, 0, 'There are no emitters');
-
- test.expect(1);
- test.done();
- },
-
- '6. the listener added should be the right listener.': function (test) {
-
- var emitter = this.emitter;
- var type = 'somelistenerbar';
- var f = function () {};
-
- emitter.on(type, f);
- test.equal(emitter.listeners(type).length, 1, 'There are is one emitters');
- test.equal(emitter.listeners(type)[0], f, 'The function should be f');
-
- test.expect(2);
- test.done();
-
- },
-
- '7. should be able to listen on any event' : function (test) {
-
- var emitter = this.emitter;
- var type = 'somelistenerbar';
- var f = function () {
- test.ok(true, 'the event was fired')
- };
-
- emitter.onAny(f);
- emitter.emit('test23.ns5.ns5', 'someData'); //1
- emitter.offAny(f);
- emitter.emit('test21'); //0
- emitter.onAny(f);
- emitter.onAny(f);
- emitter.emit('test23.ns5.ns5', 'someData'); //3
-
- test.expect(3);
- test.done();
-
- },
-
- '8. should be able to listen on any event (should cause an error)' : function (test) {
-
- var emitter = this.emitter;
- var type = 'somelistenerbar';
- var f = function () {
- test.ok(true, 'the event was fired')
- };
- emitter.onAny(f);
-
- emitter.emit('error');
-
- test.expect(1);
- test.done();
-
- },
-
- '9. onAny alias' : function (test) {
-
- var emitter = this.emitter;
- var type = 'somelistenerbar';
-
- var f = function () {
- test.ok(true, 'the event was fired');
- };
-
- emitter.on(f);
-
- emitter.emit('foo');
- emitter.emit('bar');
-
- test.expect(2);
- test.done();
-
- }
-
-});
View
136 node_modules/eventemitter2/test/simple/emit.js
@@ -1,136 +0,0 @@
-var simpleEvents = require('nodeunit').testCase;
-
-var file = '../../lib/eventemitter2';
-
-module.exports = simpleEvents({
-
- setUp: function (callback) {
- var EventEmitter2;
-
- if(typeof require !== 'undefined') {
- EventEmitter2 = require(file).EventEmitter2;
- }
- else {
- EventEmitter2 = window.EventEmitter2;
- }
-
- this.emitter = new EventEmitter2({ verbose: true });
- callback();
- },
-
- tearDown: function (callback) {
- //clean up?
- callback();
- },
-
- '1. Add two listeners on a single event and emit the event.': function (test) {
-
- var emitter = this.emitter;
-
- function functionA() { test.ok(true, 'The event was raised'); }
- function functionB() { test.ok(true, 'The event was raised'); }
-
- emitter.on('test2', functionA);
- emitter.on('test2', functionB);
-
- emitter.emit('test2');
-
- test.expect(2);
- test.done();
-
- },
- '2. Add two listeners on a single event and emit the event twice.': function (test) {
-
- var emitter = this.emitter;
-
- function functionA() { test.ok(true, 'The event was raised'); }
- function functionB() { test.ok(true, 'The event was raised'); }
-
- emitter.on('test2', functionA);
- emitter.on('test2', functionB);
-
- emitter.emit('test2');
- emitter.emit('test2');
-
- test.expect(4);
- test.done();
-
- },
- '3. Add two listeners on a single event and emit the event with a parameter.': function (test) {
-
- var emitter = this.emitter;
-
- function functionA(value1) {
- test.ok(true, 'The event was raised');
- test.equal(typeof value1, 'string', 'The event was raised');
- }
-
- function functionB(value1) {
- test.ok(true, 'The event was raised');
- test.equal(typeof value1, 'string', 'The event was raised');
- }
-
- emitter.on('test2', functionA);
- emitter.on('test2', functionB);
-
- emitter.emit('test2', 'Hello, Node');
-
- test.expect(4);
- test.done();
-
- },
- '4. Add two listeners on an single event and emit the event twice with a parameter.': function (test) {
-
- var emitter = this.emitter;
-
- function functionA(value1) {
- test.ok(true, 'The event was raised');
- test.equal(typeof value1, 'string', 'The event was raised');
- }
-
- function functionB(value1) {
- test.ok(true, 'The event was raised');
- test.equal(typeof value1, 'string', 'The event was raised');
- }
-
- emitter.on('test2', functionA);
- emitter.on('test2', functionB);
-
- emitter.emit('test2', 'Hello, Node1');
- emitter.emit('test2', 'Hello, Node2');
-
- test.expect(8);
- test.done();
-
- },
- '5. Add two listeners on an single event and emit the event twice with multiple parameters.': function (test) {
-
- var emitter = this.emitter;
-
- function functionA(value1, value2, value3) {
- test.ok(true, 'The event was raised');
- test.equal(typeof value1, 'string', 'The value named "value1" is OK');
- test.equal(typeof value2, 'string', 'The value named "value2" is OK');
- test.equal(typeof value3, 'string', 'The value named "value3" is OK');
- }
-
- function functionB(value1, value2, value3) {
- test.ok(true, 'The event was raised');
- test.equal(typeof value1, 'string', 'The value named "value1" is OK');
- test.equal(typeof value2, 'string', 'The value named "value2" is OK');
- test.equal(typeof value3, 'string', 'The value named "value3" is OK');
- }
-
- emitter.on('test2', functionA);
- emitter.on('test2', functionB);
-
- emitter.emit('test2', 'Hello, Node1', 'Hello, Node2', 'Hello, Node3');
- emitter.emit('test2', 'Hello, Node1', 'Hello, Node2', 'Hello, Node3');
-
- test.expect(16);
- test.done();
-
- }
-
-});
-
View
199 node_modules/eventemitter2/test/simple/removeListener.js
@@ -1,199 +0,0 @@
-var simpleEvents= require('nodeunit').testCase;
-
-var file = '../../lib/eventemitter2';
-
-module.exports = simpleEvents({
-
- setUp: function (callback) {
- var EventEmitter2;
-
- if(typeof require !== 'undefined') {
- EventEmitter2 = require(file).EventEmitter2;
- }
- else {
- EventEmitter2 = window.EventEmitter2;
- }
-
- this.emitter = new EventEmitter2;
- callback();
- },
-
- tearDown: function (callback) {
- //clean up?
- callback();
- },
-
- 'removeListener1. adding 1, removing 1' : function (test) {
- var emitter = this.emitter,
- type = 'remove',
- listeners;
-
- var f = function f() {
- test.ok(true, 'event was raised');
- };
-
- emitter.on(type, f);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 1, 'should only have 1');
-
- //remove
- emitter.removeListener(type, f);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 0, 'should be 0');
-
- test.expect(2);
- test.done();
- },
-
- 'removeListener2. adding 2, removing 1' : function (test) {
- var emitter = this.emitter,
- type = 'remove',
- listeners;
-
- var f = function f() {
- test.ok(true, 'event was raised');
- };
-
- emitter.on(type, f);
- emitter.on(type, f);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 2, 'should only have 2');
-
- //remove
- emitter.removeListener(type, f);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 1, 'should be 1');
-
- test.expect(2);
- test.done();
- },
-
- 'removeListener3. adding 3, removing 1' : function (test) {
- var emitter = this.emitter,
- type = 'remove',
- listeners;
-
- var f = function f() {
- test.ok(true, 'event was raised');
- };
-
- emitter.on(type, f);
- emitter.on(type, f);
- emitter.on(type, f);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 3, 'should only have 3');
-
- //remove
- emitter.removeListener(type, f);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 2, 'should be 2');
-
- test.expect(2);
- test.done();
- },
-
- 'removeListener4. should error if we don\'t pass in a function' : function (test) {
- var emitter = this.emitter,
- type = 'remove',
- listeners;
-
- var f = function f() {
- test.ok(true, 'event was raised');
- };
-
- emitter.on(type, f);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 1, 'should only have 1');
-
- //remove
- test.throws(function () {emitter.removeListener(type, type)}, Error, 'should throw an Error');
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 1, 'should be 1');
-
- test.expect(3);
- test.done();
- },
-
- 'removeListener5. removing a different function, should not remove' : function (test) {
- var emitter = this.emitter,
- type = 'remove',
- listeners;
-
- var f = function f() {
- test.ok(true, 'event was raised');
- };
- var g = function g() {
- test.ok(true, 'event was raised');
- };
-
- emitter.on(type, f);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 1, 'should only have 1');
-
- //remove
- emitter.removeListener(type, g);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 1, 'should be 1');
-
- test.expect(2);
- test.done();
- },
-
- 'removeListener6. removing all functions' : function (test) {
- var emitter = this.emitter,
- type = 'remove',
- listeners;
-
- var f = function f() {
- test.ok(true, 'event was raised');
- };
- for (var i = 0; i < 10; i++) {
- emitter.on(type, f);
- }
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 10, 'should only have 10');
-
- emitter.removeListener(type, f);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 9, 'should be 9');
- emitter.removeAllListeners(type);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 0, 'should be 0');
-
- test.expect(3);
- test.done();
- },
-
- 'removeListener7. removing different event, should not remove' : function (test) {
- var emitter = this.emitter,
- type = 'remove',
- listeners;
-
- var f = function f() {
- test.ok(true, 'event was raised');
- };
-
- for (var i = 0; i < 10; i++) {
- emitter.on(type, f);
- }
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 10, 'should only have 10');
-
- emitter.removeListener(type+type, f);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 10, 'should be 10');
-
- emitter.removeAllListeners(type+type);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 10, 'should be 10');
-
- emitter.removeAllListeners(type);
- listeners = emitter.listeners(type);
- test.equal(listeners.length, 0, 'should be 0');
-
- test.expect(4);
- test.done();
- },
-
-
-});
View
133 node_modules/eventemitter2/test/simple/setMax.js
@@ -1,133 +0,0 @@
-var simpleEvents= require('nodeunit').testCase;
-
-var file = '../../lib/eventemitter2';
-
-module.exports = simpleEvents({
-
- setUp: function (callback) {
- var EventEmitter2;
-
- if(typeof require !== 'undefined') {
- EventEmitter2 = require(file).EventEmitter2;
- }
- else {
- EventEmitter2 = window.EventEmitter2;
- }
-
- this.emitter = new EventEmitter2;
- callback();
- },
-
- tearDown: function (callback) {
- //clean up?
- callback();
- },
-
- 'setMaxListener1. default behavior of 10 listeners.' : function (test) {
- var emitter = this.emitter;
-
- for (var i = 0; i < 10; i++) {
- emitter.on('foobar', function () {
- test.ok(true, 'event was raised');
- });
- }
-
- var listeners = emitter.listeners('foobar');
- test.equal(listeners.length, 10, 'should only have 10');
-
- test.expect(1);
- test.done();
- },
-
- 'setMaxListener2. If we added more than 10, should not see them' : function (test) {
- var emitter = this.emitter;
-
- for (var i = 0; i < 10 ; i++) {
- emitter.on('foobar2', function () {
- test.ok(true, 'event was raised');
- });
- }
- console.log('should see EE2 complaining:');
- emitter.on('foobar2', function () {
- test.ok(true, 'event was raised');
- });
- console.log('move on');
-
- var listeners = emitter.listeners('foobar2');
- test.equal(listeners.length, 11, 'should have 11');
- test.ok(emitter._events['foobar2'].warned, 'should have been warned');
-
- test.expect(2);
- test.done();
- },
-
- 'setMaxListener3. if we set maxListener to be greater before adding' : function (test) {
- var emitter = this.emitter;
- var type = 'foobar3';
-
- // set to 20
- emitter.setMaxListeners(20);
-
- for (var i = 0; i < 15 ; i++) {
- emitter.on(type, function () {
- test.ok(true, 'event was raised');
- });
- }
-
-// require('eyes').inspect(emitter._events);
-
- var listeners = emitter.listeners(type);
- test.equal(listeners.length, 15, 'should have 15');
- test.ok(!(emitter._events[type].warned), 'should not have been set');
-
- test.expect(2);
- test.done();
- },
-
- 'setMaxListener4. should be able to change it right at 10' : function (test) {
- var emitter = this.emitter;
- var type = 'foobar4';
-
- for (var i = 0; i < 10 ; i++) {
- emitter.on(type, function () {
- test.ok(true, 'event was raised');
- });
- }
-
- emitter.setMaxListeners(9001);
- emitter.on(type, function () {
- test.ok(true, 'event was raised');
- });
-
-// require('eyes').inspect(emitter._events);
-
- var listeners = emitter.listeners(type);
- test.equal(listeners.length, 11, 'should have 11');
- test.ok(!(emitter._events[type].warned), 'should not have been set');
-
- test.expect(2);
- test.done();
- },
-
- 'setMaxListener5. if we set maxListener to be 0 should add endlessly' : function (test) {
- var emitter = this.emitter;
- var type = 'foobar';
-
- // set to 0
- emitter.setMaxListeners(0);
-
- for (var i = 0; i < 25 ; i++) {
- emitter.on(type, function () {
- test.ok(true, 'event was raised');
- });
- }
-
- var listeners = emitter.listeners(type);
- test.equal(listeners.length, 25, 'should have 25');
- test.ok(!(emitter._events[type].warned), 'should not have been set');
-
- test.expect(2);
- test.done();
- },
-
-});
View
126 node_modules/eventemitter2/test/simple/ttl.js
@@ -1,126 +0,0 @@
-var simpleEvents = require('nodeunit').testCase;
-
-var file = '../../lib/eventemitter2';
-
-module.exports = simpleEvents({
-
- setUp: function (callback) {
- var EventEmitter2;
-
- if(typeof require !== 'undefined') {
- EventEmitter2 = require(file).EventEmitter2;
- }
- else {
- EventEmitter2 = window.EventEmitter2;
- }
-
- this.emitter = new EventEmitter2();
- callback();
- },
-
- tearDown: function (callback) {
- //clean up?
- callback();
- },
-
- '1. A listener added with `once` should only listen once and then be removed.': function (test) {
-
- var emitter = this.emitter;
-
- emitter.once('test1', function () {
- test.ok(true, 'The event was raised once');
- });
-
- emitter.emit('test1');
- emitter.emit('test1');
-
- test.expect(1);
- test.done();
-
- },
- '2. A listener with a TTL of 4 should only listen 4 times.': function (test) {
-
- var emitter = this.emitter;
-
- emitter.many('test1', 4, function (value1) {
- test.ok(true, 'The event was raised 4 times.');
- });
-
- emitter.emit('test1', 1);
- emitter.emit('test1', 2);
- emitter.emit('test1', 3);
- emitter.emit('test1', 4);
- emitter.emit('test1', 5);
-
- test.expect(4);
- test.done();
-
- },
- '3. A listener with a TTL of 4 should only listen 4 times and pass parameters.': function (test) {
-
- var emitter = this.emitter;
-
- emitter.many('test1', 4, function (value1, value2, value3) {
- test.ok(typeof value1 !== 'undefined', 'got value 1');
- test.ok(typeof value2 !== 'undefined', 'got value 2');
- test.ok(typeof value3 !== 'undefined', 'got value 3');
- });
-
- emitter.emit('test1', 1, 'A', false);
- emitter.emit('test1', 2, 'A', false);
- emitter.emit('test1', 3, 'A', false);
- emitter.emit('test1', 4, 'A', false);
- emitter.emit('test1', 5, 'A', false);
-
- test.done();
-
- },
- '4. Remove an event listener by signature.': function (test) {
-
- var emitter = this.emitter;
- var count = 0;
-
- function f1(event) {
- "event A";
- test.ok(true, 'The event was raised less than 3 times.');
- }
-
- emitter.on('test1', f1);
-
- function f2(event) {
- "event B";
- test.ok(true, 'The event was raised less than 3 times.');
- }
-
- emitter.on('test1', f2);
-
- function f3(event) {
- "event C";
- test.ok(true, 'The event was raised less than 3 times.');
- }
-
- emitter.on('test1', f3);
-
- emitter.removeListener('test1', f2);
-
- emitter.emit('test1');
-
- test.expect(2);
- test.done();
-
- },
- '5. `removeListener` and `once`': function(test) {
-
- var emitter = this.emitter;
- var functionA = function() { test.ok(true, 'Event was fired'); };
-
- emitter.once('testA', functionA);
- emitter.removeListener('testA', functionA);
-
- emitter.emit('testA');
-
- test.expect(0);
- test.done();
- }
-
-});
View
287 node_modules/eventemitter2/test/wildcardEvents/addListener.js
@@ -1,287 +0,0 @@
-
-var simpleEvents = require('nodeunit').testCase;
-var file = '../../lib/eventemitter2';
-
-module.exports = simpleEvents({
-
- setUp: function (callback) {
- var EventEmitter2;
-
- if(typeof require !== 'undefined') {
- EventEmitter2 = require(file).EventEmitter2;
- }
- else {
- EventEmitter2 = window.EventEmitter2;
- }
-
- this.emitter = new EventEmitter2({
- wildcard: true
- });
- callback();
- },
-
- tearDown: function (callback) {
- //clean up?
- callback();
- },
-
- '1. Add a single listener on a single event.': function (test) {
-
- var emitter = this.emitter;
- var type = 'some.listener.bar';
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners(type).length, 1, 'There are three emitters');
-
- test.expect(1);
- test.done();
-
- },
-
- '1a. Add a single listener on a single event (using an array).': function (test) {
-
- var emitter = this.emitter;
- var type = ['some', 'listener', 'bar'];
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners(type).length, 1, 'There are three emitters');
-
- test.expect(1);
- test.done();
-
- },
-
- '2. Add two listeners on a single event.': function (test) {
-
- var emitter = this.emitter;
- var type = 'some.listener.bar';
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners(type).length, 2, 'There are three emitters');
-
- test.expect(1);
- test.done();
-
- },
-
- '2a. Add two listeners on a single event (using an array).': function (test) {
-
- var emitter = this.emitter;
- var type = ['some', 'listener', 'bar'];
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners(type).length, 2, 'There are three emitters');
-
- test.expect(1);
- test.done();
-
- },
-
- '3. Add three listeners on a single event.': function (test) {
-
- var emitter = this.emitter;
- var type = 'some.listener.bar';
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners(type).length, 3, 'There are three emitters');
-
- test.expect(1);
- test.done();
-
- },
-
- '4. Add two listeners to two different events.': function (test) {
-
- var emitter = this.emitter;
- var type = 'some.listener.bar';
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on('test2', function () {
- test.ok(true, 'The event was raised');
- });
-
- emitter.on('test2', function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners(type).length, 2, 'There are two emitters');
- test.equal(emitter.listeners('test2').length, 2, 'There are two emitters');
-
- test.expect(2);
- test.done();
- },
-
- '5. Never adding any listeners should yield a listeners array with the length of 0.': function (test) {
- var emitter = this.emitter;
- var type = 'some.listener.bar';
-
- emitter.on(type, function () {
- test.ok(true, 'The event was raised');
- });
-
- test.equal(emitter.listeners('test2').length, 0, 'There are no emitters');
-
- test.expect(1);