小程序蓝牙通信例子
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

799 lines
23 KiB

  1. module.exports = (function() {
  2. var __MODS__ = {};
  3. var __DEFINE__ = function(modId, func, req) { var m = { exports: {} }; __MODS__[modId] = { status: 0, func: func, req: req, m: m }; };
  4. var __REQUIRE__ = function(modId, source) { if(!__MODS__[modId]) return require(source); if(!__MODS__[modId].status) { var m = { exports: {} }; __MODS__[modId].status = 1; __MODS__[modId].func(__MODS__[modId].req, m, m.exports); if(typeof m.exports === "object") { __MODS__[modId].m.exports.__proto__ = m.exports.__proto__; Object.keys(m.exports).forEach(function(k) { __MODS__[modId].m.exports[k] = m.exports[k]; var desp = Object.getOwnPropertyDescriptor(m.exports, k); if(desp && desp.configurable) Object.defineProperty(m.exports, k, { set: function(val) { __MODS__[modId].m.exports[k] = val; }, get: function() { return __MODS__[modId].m.exports[k]; } }); }); if(m.exports.__esModule) Object.defineProperty(__MODS__[modId].m.exports, "__esModule", { value: true }); } else { __MODS__[modId].m.exports = m.exports; } } return __MODS__[modId].m.exports; };
  5. var __REQUIRE_WILDCARD__ = function(obj) { if(obj && obj.__esModule) { return obj; } else { var newObj = {}; if(obj != null) { for(var k in obj) { if (Object.prototype.hasOwnProperty.call(obj, k)) newObj[k] = obj[k]; } } newObj.default = obj; return newObj; } };
  6. var __REQUIRE_DEFAULT__ = function(obj) { return obj && obj.__esModule ? obj.default : obj; };
  7. __DEFINE__(1585827830357, function(require, module, exports) {
  8. /*!
  9. * EventEmitter2
  10. * https://github.com/hij1nx/EventEmitter2
  11. *
  12. * Copyright (c) 2013 hij1nx
  13. * Licensed under the MIT license.
  14. */
  15. ;!function(undefined) {
  16. var isArray = Array.isArray ? Array.isArray : function _isArray(obj) {
  17. return Object.prototype.toString.call(obj) === "[object Array]";
  18. };
  19. var defaultMaxListeners = 10;
  20. function init() {
  21. this._events = {};
  22. if (this._conf) {
  23. configure.call(this, this._conf);
  24. }
  25. }
  26. function configure(conf) {
  27. if (conf) {
  28. this._conf = conf;
  29. conf.delimiter && (this.delimiter = conf.delimiter);
  30. this._maxListeners = conf.maxListeners !== undefined ? conf.maxListeners : defaultMaxListeners;
  31. conf.wildcard && (this.wildcard = conf.wildcard);
  32. conf.newListener && (this._newListener = conf.newListener);
  33. conf.removeListener && (this._removeListener = conf.removeListener);
  34. conf.verboseMemoryLeak && (this.verboseMemoryLeak = conf.verboseMemoryLeak);
  35. if (this.wildcard) {
  36. this.listenerTree = {};
  37. }
  38. } else {
  39. this._maxListeners = defaultMaxListeners;
  40. }
  41. }
  42. function logPossibleMemoryLeak(count, eventName) {
  43. var errorMsg = '(node) warning: possible EventEmitter memory ' +
  44. 'leak detected. ' + count + ' listeners added. ' +
  45. 'Use emitter.setMaxListeners() to increase limit.';
  46. if(this.verboseMemoryLeak){
  47. errorMsg += ' Event name: ' + eventName + '.';
  48. }
  49. if(typeof process !== 'undefined' && process.emitWarning){
  50. var e = new Error(errorMsg);
  51. e.name = 'MaxListenersExceededWarning';
  52. e.emitter = this;
  53. e.count = count;
  54. process.emitWarning(e);
  55. } else {
  56. console.error(errorMsg);
  57. if (console.trace){
  58. console.trace();
  59. }
  60. }
  61. }
  62. function EventEmitter(conf) {
  63. this._events = {};
  64. this._newListener = false;
  65. this._removeListener = false;
  66. this.verboseMemoryLeak = false;
  67. configure.call(this, conf);
  68. }
  69. EventEmitter.EventEmitter2 = EventEmitter; // backwards compatibility for exporting EventEmitter property
  70. //
  71. // Attention, function return type now is array, always !
  72. // It has zero elements if no any matches found and one or more
  73. // elements (leafs) if there are matches
  74. //
  75. function searchListenerTree(handlers, type, tree, i) {
  76. if (!tree) {
  77. return [];
  78. }
  79. var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached,
  80. typeLength = type.length, currentType = type[i], nextType = type[i+1];
  81. if (i === typeLength && tree._listeners) {
  82. //
  83. // If at the end of the event(s) list and the tree has listeners
  84. // invoke those listeners.
  85. //
  86. if (typeof tree._listeners === 'function') {
  87. handlers && handlers.push(tree._listeners);
  88. return [tree];
  89. } else {
  90. for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) {
  91. handlers && handlers.push(tree._listeners[leaf]);
  92. }
  93. return [tree];
  94. }
  95. }
  96. if ((currentType === '*' || currentType === '**') || tree[currentType]) {
  97. //
  98. // If the event emitted is '*' at this part
  99. // or there is a concrete match at this patch
  100. //
  101. if (currentType === '*') {
  102. for (branch in tree) {
  103. if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
  104. listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1));
  105. }
  106. }
  107. return listeners;
  108. } else if(currentType === '**') {
  109. endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*'));
  110. if(endReached && tree._listeners) {
  111. // The next element has a _listeners, add it to the handlers.
  112. listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength));
  113. }
  114. for (branch in tree) {
  115. if (branch !== '_listeners' && tree.hasOwnProperty(branch)) {
  116. if(branch === '*' || branch === '**') {
  117. if(tree[branch]._listeners && !endReached) {
  118. listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength));
  119. }
  120. listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
  121. } else if(branch === nextType) {
  122. listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2));
  123. } else {
  124. // No match on this one, shift into the tree but not in the type array.
  125. listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i));
  126. }
  127. }
  128. }
  129. return listeners;
  130. }
  131. listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1));
  132. }
  133. xTree = tree['*'];
  134. if (xTree) {
  135. //
  136. // If the listener tree will allow any match for this part,
  137. // then recursively explore all branches of the tree
  138. //
  139. searchListenerTree(handlers, type, xTree, i+1);
  140. }
  141. xxTree = tree['**'];
  142. if(xxTree) {
  143. if(i < typeLength) {
  144. if(xxTree._listeners) {
  145. // If we have a listener on a '**', it will catch all, so add its handler.
  146. searchListenerTree(handlers, type, xxTree, typeLength);
  147. }
  148. // Build arrays of matching next branches and others.
  149. for(branch in xxTree) {
  150. if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) {
  151. if(branch === nextType) {
  152. // We know the next element will match, so jump twice.
  153. searchListenerTree(handlers, type, xxTree[branch], i+2);
  154. } else if(branch === currentType) {
  155. // Current node matches, move into the tree.
  156. searchListenerTree(handlers, type, xxTree[branch], i+1);
  157. } else {
  158. isolatedBranch = {};
  159. isolatedBranch[branch] = xxTree[branch];
  160. searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1);
  161. }
  162. }
  163. }
  164. } else if(xxTree._listeners) {
  165. // We have reached the end and still on a '**'
  166. searchListenerTree(handlers, type, xxTree, typeLength);
  167. } else if(xxTree['*'] && xxTree['*']._listeners) {
  168. searchListenerTree(handlers, type, xxTree['*'], typeLength);
  169. }
  170. }
  171. return listeners;
  172. }
  173. function growListenerTree(type, listener) {
  174. type = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
  175. //
  176. // Looks for two consecutive '**', if so, don't add the event at all.
  177. //
  178. for(var i = 0, len = type.length; i+1 < len; i++) {
  179. if(type[i] === '**' && type[i+1] === '**') {
  180. return;
  181. }
  182. }
  183. var tree = this.listenerTree;
  184. var name = type.shift();
  185. while (name !== undefined) {
  186. if (!tree[name]) {
  187. tree[name] = {};
  188. }
  189. tree = tree[name];
  190. if (type.length === 0) {
  191. if (!tree._listeners) {
  192. tree._listeners = listener;
  193. }
  194. else {
  195. if (typeof tree._listeners === 'function') {
  196. tree._listeners = [tree._listeners];
  197. }
  198. tree._listeners.push(listener);
  199. if (
  200. !tree._listeners.warned &&
  201. this._maxListeners > 0 &&
  202. tree._listeners.length > this._maxListeners
  203. ) {
  204. tree._listeners.warned = true;
  205. logPossibleMemoryLeak.call(this, tree._listeners.length, name);
  206. }
  207. }
  208. return true;
  209. }
  210. name = type.shift();
  211. }
  212. return true;
  213. }
  214. // By default EventEmitters will print a warning if more than
  215. // 10 listeners are added to it. This is a useful default which
  216. // helps finding memory leaks.
  217. //
  218. // Obviously not all Emitters should be limited to 10. This function allows
  219. // that to be increased. Set to zero for unlimited.
  220. EventEmitter.prototype.delimiter = '.';
  221. EventEmitter.prototype.setMaxListeners = function(n) {
  222. if (n !== undefined) {
  223. this._maxListeners = n;
  224. if (!this._conf) this._conf = {};
  225. this._conf.maxListeners = n;
  226. }
  227. };
  228. EventEmitter.prototype.event = '';
  229. EventEmitter.prototype.once = function(event, fn) {
  230. return this._once(event, fn, false);
  231. };
  232. EventEmitter.prototype.prependOnceListener = function(event, fn) {
  233. return this._once(event, fn, true);
  234. };
  235. EventEmitter.prototype._once = function(event, fn, prepend) {
  236. this._many(event, 1, fn, prepend);
  237. return this;
  238. };
  239. EventEmitter.prototype.many = function(event, ttl, fn) {
  240. return this._many(event, ttl, fn, false);
  241. }
  242. EventEmitter.prototype.prependMany = function(event, ttl, fn) {
  243. return this._many(event, ttl, fn, true);
  244. }
  245. EventEmitter.prototype._many = function(event, ttl, fn, prepend) {
  246. var self = this;
  247. if (typeof fn !== 'function') {
  248. throw new Error('many only accepts instances of Function');
  249. }
  250. function listener() {
  251. if (--ttl === 0) {
  252. self.off(event, listener);
  253. }
  254. return fn.apply(this, arguments);
  255. }
  256. listener._origin = fn;
  257. this._on(event, listener, prepend);
  258. return self;
  259. };
  260. EventEmitter.prototype.emit = function() {
  261. if (!this._events && !this._all) {
  262. return false;
  263. }
  264. this._events || init.call(this);
  265. var type = arguments[0];
  266. if (type === 'newListener' && !this._newListener) {
  267. if (!this._events.newListener) {
  268. return false;
  269. }
  270. }
  271. var al = arguments.length;
  272. var args,l,i,j;
  273. var handler;
  274. if (this._all && this._all.length) {
  275. handler = this._all.slice();
  276. if (al > 3) {
  277. args = new Array(al);
  278. for (j = 0; j < al; j++) args[j] = arguments[j];
  279. }
  280. for (i = 0, l = handler.length; i < l; i++) {
  281. this.event = type;
  282. switch (al) {
  283. case 1:
  284. handler[i].call(this, type);
  285. break;
  286. case 2:
  287. handler[i].call(this, type, arguments[1]);
  288. break;
  289. case 3:
  290. handler[i].call(this, type, arguments[1], arguments[2]);
  291. break;
  292. default:
  293. handler[i].apply(this, args);
  294. }
  295. }
  296. }
  297. if (this.wildcard) {
  298. handler = [];
  299. var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
  300. searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
  301. } else {
  302. handler = this._events[type];
  303. if (typeof handler === 'function') {
  304. this.event = type;
  305. switch (al) {
  306. case 1:
  307. handler.call(this);
  308. break;
  309. case 2:
  310. handler.call(this, arguments[1]);
  311. break;
  312. case 3:
  313. handler.call(this, arguments[1], arguments[2]);
  314. break;
  315. default:
  316. args = new Array(al - 1);
  317. for (j = 1; j < al; j++) args[j - 1] = arguments[j];
  318. handler.apply(this, args);
  319. }
  320. return true;
  321. } else if (handler) {
  322. // need to make copy of handlers because list can change in the middle
  323. // of emit call
  324. handler = handler.slice();
  325. }
  326. }
  327. if (handler && handler.length) {
  328. if (al > 3) {
  329. args = new Array(al - 1);
  330. for (j = 1; j < al; j++) args[j - 1] = arguments[j];
  331. }
  332. for (i = 0, l = handler.length; i < l; i++) {
  333. this.event = type;
  334. switch (al) {
  335. case 1:
  336. handler[i].call(this);
  337. break;
  338. case 2:
  339. handler[i].call(this, arguments[1]);
  340. break;
  341. case 3:
  342. handler[i].call(this, arguments[1], arguments[2]);
  343. break;
  344. default:
  345. handler[i].apply(this, args);
  346. }
  347. }
  348. return true;
  349. } else if (!this._all && type === 'error') {
  350. if (arguments[1] instanceof Error) {
  351. throw arguments[1]; // Unhandled 'error' event
  352. } else {
  353. throw new Error("Uncaught, unspecified 'error' event.");
  354. }
  355. return false;
  356. }
  357. return !!this._all;
  358. };
  359. EventEmitter.prototype.emitAsync = function() {
  360. if (!this._events && !this._all) {
  361. return false;
  362. }
  363. this._events || init.call(this);
  364. var type = arguments[0];
  365. if (type === 'newListener' && !this._newListener) {
  366. if (!this._events.newListener) { return Promise.resolve([false]); }
  367. }
  368. var promises= [];
  369. var al = arguments.length;
  370. var args,l,i,j;
  371. var handler;
  372. if (this._all) {
  373. if (al > 3) {
  374. args = new Array(al);
  375. for (j = 1; j < al; j++) args[j] = arguments[j];
  376. }
  377. for (i = 0, l = this._all.length; i < l; i++) {
  378. this.event = type;
  379. switch (al) {
  380. case 1:
  381. promises.push(this._all[i].call(this, type));
  382. break;
  383. case 2:
  384. promises.push(this._all[i].call(this, type, arguments[1]));
  385. break;
  386. case 3:
  387. promises.push(this._all[i].call(this, type, arguments[1], arguments[2]));
  388. break;
  389. default:
  390. promises.push(this._all[i].apply(this, args));
  391. }
  392. }
  393. }
  394. if (this.wildcard) {
  395. handler = [];
  396. var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
  397. searchListenerTree.call(this, handler, ns, this.listenerTree, 0);
  398. } else {
  399. handler = this._events[type];
  400. }
  401. if (typeof handler === 'function') {
  402. this.event = type;
  403. switch (al) {
  404. case 1:
  405. promises.push(handler.call(this));
  406. break;
  407. case 2:
  408. promises.push(handler.call(this, arguments[1]));
  409. break;
  410. case 3:
  411. promises.push(handler.call(this, arguments[1], arguments[2]));
  412. break;
  413. default:
  414. args = new Array(al - 1);
  415. for (j = 1; j < al; j++) args[j - 1] = arguments[j];
  416. promises.push(handler.apply(this, args));
  417. }
  418. } else if (handler && handler.length) {
  419. handler = handler.slice();
  420. if (al > 3) {
  421. args = new Array(al - 1);
  422. for (j = 1; j < al; j++) args[j - 1] = arguments[j];
  423. }
  424. for (i = 0, l = handler.length; i < l; i++) {
  425. this.event = type;
  426. switch (al) {
  427. case 1:
  428. promises.push(handler[i].call(this));
  429. break;
  430. case 2:
  431. promises.push(handler[i].call(this, arguments[1]));
  432. break;
  433. case 3:
  434. promises.push(handler[i].call(this, arguments[1], arguments[2]));
  435. break;
  436. default:
  437. promises.push(handler[i].apply(this, args));
  438. }
  439. }
  440. } else if (!this._all && type === 'error') {
  441. if (arguments[1] instanceof Error) {
  442. return Promise.reject(arguments[1]); // Unhandled 'error' event
  443. } else {
  444. return Promise.reject("Uncaught, unspecified 'error' event.");
  445. }
  446. }
  447. return Promise.all(promises);
  448. };
  449. EventEmitter.prototype.on = function(type, listener) {
  450. return this._on(type, listener, false);
  451. };
  452. EventEmitter.prototype.prependListener = function(type, listener) {
  453. return this._on(type, listener, true);
  454. };
  455. EventEmitter.prototype.onAny = function(fn) {
  456. return this._onAny(fn, false);
  457. };
  458. EventEmitter.prototype.prependAny = function(fn) {
  459. return this._onAny(fn, true);
  460. };
  461. EventEmitter.prototype.addListener = EventEmitter.prototype.on;
  462. EventEmitter.prototype._onAny = function(fn, prepend){
  463. if (typeof fn !== 'function') {
  464. throw new Error('onAny only accepts instances of Function');
  465. }
  466. if (!this._all) {
  467. this._all = [];
  468. }
  469. // Add the function to the event listener collection.
  470. if(prepend){
  471. this._all.unshift(fn);
  472. }else{
  473. this._all.push(fn);
  474. }
  475. return this;
  476. }
  477. EventEmitter.prototype._on = function(type, listener, prepend) {
  478. if (typeof type === 'function') {
  479. this._onAny(type, listener);
  480. return this;
  481. }
  482. if (typeof listener !== 'function') {
  483. throw new Error('on only accepts instances of Function');
  484. }
  485. this._events || init.call(this);
  486. // To avoid recursion in the case that type == "newListeners"! Before
  487. // adding it to the listeners, first emit "newListeners".
  488. if (this._newListener)
  489. this.emit('newListener', type, listener);
  490. if (this.wildcard) {
  491. growListenerTree.call(this, type, listener);
  492. return this;
  493. }
  494. if (!this._events[type]) {
  495. // Optimize the case of one listener. Don't need the extra array object.
  496. this._events[type] = listener;
  497. }
  498. else {
  499. if (typeof this._events[type] === 'function') {
  500. // Change to array.
  501. this._events[type] = [this._events[type]];
  502. }
  503. // If we've already got an array, just add
  504. if(prepend){
  505. this._events[type].unshift(listener);
  506. }else{
  507. this._events[type].push(listener);
  508. }
  509. // Check for listener leak
  510. if (
  511. !this._events[type].warned &&
  512. this._maxListeners > 0 &&
  513. this._events[type].length > this._maxListeners
  514. ) {
  515. this._events[type].warned = true;
  516. logPossibleMemoryLeak.call(this, this._events[type].length, type);
  517. }
  518. }
  519. return this;
  520. }
  521. EventEmitter.prototype.off = function(type, listener) {
  522. if (typeof listener !== 'function') {
  523. throw new Error('removeListener only takes instances of Function');
  524. }
  525. var handlers,leafs=[];
  526. if(this.wildcard) {
  527. var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
  528. leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
  529. }
  530. else {
  531. // does not use listeners(), so no side effect of creating _events[type]
  532. if (!this._events[type]) return this;
  533. handlers = this._events[type];
  534. leafs.push({_listeners:handlers});
  535. }
  536. for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
  537. var leaf = leafs[iLeaf];
  538. handlers = leaf._listeners;
  539. if (isArray(handlers)) {
  540. var position = -1;
  541. for (var i = 0, length = handlers.length; i < length; i++) {
  542. if (handlers[i] === listener ||
  543. (handlers[i].listener && handlers[i].listener === listener) ||
  544. (handlers[i]._origin && handlers[i]._origin === listener)) {
  545. position = i;
  546. break;
  547. }
  548. }
  549. if (position < 0) {
  550. continue;
  551. }
  552. if(this.wildcard) {
  553. leaf._listeners.splice(position, 1);
  554. }
  555. else {
  556. this._events[type].splice(position, 1);
  557. }
  558. if (handlers.length === 0) {
  559. if(this.wildcard) {
  560. delete leaf._listeners;
  561. }
  562. else {
  563. delete this._events[type];
  564. }
  565. }
  566. if (this._removeListener)
  567. this.emit("removeListener", type, listener);
  568. return this;
  569. }
  570. else if (handlers === listener ||
  571. (handlers.listener && handlers.listener === listener) ||
  572. (handlers._origin && handlers._origin === listener)) {
  573. if(this.wildcard) {
  574. delete leaf._listeners;
  575. }
  576. else {
  577. delete this._events[type];
  578. }
  579. if (this._removeListener)
  580. this.emit("removeListener", type, listener);
  581. }
  582. }
  583. function recursivelyGarbageCollect(root) {
  584. if (root === undefined) {
  585. return;
  586. }
  587. var keys = Object.keys(root);
  588. for (var i in keys) {
  589. var key = keys[i];
  590. var obj = root[key];
  591. if ((obj instanceof Function) || (typeof obj !== "object") || (obj === null))
  592. continue;
  593. if (Object.keys(obj).length > 0) {
  594. recursivelyGarbageCollect(root[key]);
  595. }
  596. if (Object.keys(obj).length === 0) {
  597. delete root[key];
  598. }
  599. }
  600. }
  601. recursivelyGarbageCollect(this.listenerTree);
  602. return this;
  603. };
  604. EventEmitter.prototype.offAny = function(fn) {
  605. var i = 0, l = 0, fns;
  606. if (fn && this._all && this._all.length > 0) {
  607. fns = this._all;
  608. for(i = 0, l = fns.length; i < l; i++) {
  609. if(fn === fns[i]) {
  610. fns.splice(i, 1);
  611. if (this._removeListener)
  612. this.emit("removeListenerAny", fn);
  613. return this;
  614. }
  615. }
  616. } else {
  617. fns = this._all;
  618. if (this._removeListener) {
  619. for(i = 0, l = fns.length; i < l; i++)
  620. this.emit("removeListenerAny", fns[i]);
  621. }
  622. this._all = [];
  623. }
  624. return this;
  625. };
  626. EventEmitter.prototype.removeListener = EventEmitter.prototype.off;
  627. EventEmitter.prototype.removeAllListeners = function(type) {
  628. if (type === undefined) {
  629. !this._events || init.call(this);
  630. return this;
  631. }
  632. if (this.wildcard) {
  633. var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
  634. var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0);
  635. for (var iLeaf=0; iLeaf<leafs.length; iLeaf++) {
  636. var leaf = leafs[iLeaf];
  637. leaf._listeners = null;
  638. }
  639. }
  640. else if (this._events) {
  641. this._events[type] = null;
  642. }
  643. return this;
  644. };
  645. EventEmitter.prototype.listeners = function(type) {
  646. if (this.wildcard) {
  647. var handlers = [];
  648. var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice();
  649. searchListenerTree.call(this, handlers, ns, this.listenerTree, 0);
  650. return handlers;
  651. }
  652. this._events || init.call(this);
  653. if (!this._events[type]) this._events[type] = [];
  654. if (!isArray(this._events[type])) {
  655. this._events[type] = [this._events[type]];
  656. }
  657. return this._events[type];
  658. };
  659. EventEmitter.prototype.eventNames = function(){
  660. return Object.keys(this._events);
  661. }
  662. EventEmitter.prototype.listenerCount = function(type) {
  663. return this.listeners(type).length;
  664. };
  665. EventEmitter.prototype.listenersAny = function() {
  666. if(this._all) {
  667. return this._all;
  668. }
  669. else {
  670. return [];
  671. }
  672. };
  673. if (typeof define === 'function' && define.amd) {
  674. // AMD. Register as an anonymous module.
  675. define(function() {
  676. return EventEmitter;
  677. });
  678. } else if (typeof exports === 'object') {
  679. // CommonJS
  680. module.exports = EventEmitter;
  681. }
  682. else {
  683. // Browser global.
  684. window.EventEmitter2 = EventEmitter;
  685. }
  686. }();
  687. }, function(modId) {var map = {}; return __REQUIRE__(map[modId], modId); })
  688. return __REQUIRE__(1585827830357);
  689. })()
  690. //# sourceMappingURL=index.js.map