UNPKG

github-release-info-downloader

Version:

Gets latest release download URL using the GitHub Releases API. It also shows when it was released and the download count.

20 lines (16 loc) 532 B
var Emitter = require('tiny-emitter'); /** * Extend given object with emitter functions `on`, `off`, `once`, `emit` * @param {Object} obj * @return {Object} obj */ exports.mixin = function (obj) { // create event emitter var emitter = new Emitter(); // bind methods to obj (we don't want to expose the emitter.e Array...) obj.on = emitter.on.bind(emitter); obj.off = emitter.off.bind(emitter); obj.once = emitter.once.bind(emitter); obj.emit = emitter.emit.bind(emitter); return obj; };