forked from phcode-dev/staging.phcode.dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEventEmitter.js
More file actions
1 lines (1 loc) · 848 Bytes
/
Copy pathEventEmitter.js
File metadata and controls
1 lines (1 loc) · 848 Bytes
1
define(function(require,exports,module){const EventDispatcher=brackets.getModule("utils/EventDispatcher"),Metrics=brackets.getModule("utils/Metrics"),emInstance={};function getEmitter(eventName,optionalMetricToLog){if(!eventName)throw new Error("no event has been passed to get the emittor!");return function(){emit(eventName,...arguments),optionalMetricToLog&&Metrics.countEvent(Metrics.EVENT_TYPE.GIT,optionalMetricToLog[0],optionalMetricToLog[1])}}function emit(){emInstance.trigger(...arguments)}function on(eventName,callback){emInstance.on(eventName,(...args)=>{const[,...rest]=args;callback(...rest)})}function one(eventName,callback){emInstance.one(eventName,(...args)=>{const[,...rest]=args;callback(...rest)})}EventDispatcher.makeEventDispatcher(emInstance),exports.getEmitter=getEmitter,exports.emit=emit,exports.on=on,exports.one=one});