all-off.js 457 B

12345678910111213141516171819
  1. 'use strict';
  2. var value = require('es5-ext/object/valid-object')
  3. , hasOwnProperty = Object.prototype.hasOwnProperty;
  4. module.exports = function (emitter/*, type*/) {
  5. var type = arguments[1], data;
  6. value(emitter);
  7. if (type !== undefined) {
  8. data = hasOwnProperty.call(emitter, '__ee__') && emitter.__ee__;
  9. if (!data) return;
  10. if (data[type]) delete data[type];
  11. return;
  12. }
  13. if (hasOwnProperty.call(emitter, '__ee__')) delete emitter.__ee__;
  14. };