diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..ffd3478 Binary files /dev/null and b/.DS_Store differ diff --git a/dist/provent.min.js b/dist/provent.min.js new file mode 100644 index 0000000..277c3b3 --- /dev/null +++ b/dist/provent.min.js @@ -0,0 +1,2 @@ +(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o0?[callbackReturn]:params)}function setRejectContext(context){reject=function(id){if(id)return removeThenCallback(id);this.elements.forEach(function(element){element.removeEventListener(this.event,this.handler)}.bind(this));callbacks={}}.bind(context);return reject}function removeThenCallback(id){for(cbId in callbacks){callbacks[cbId]=callbacks[cbId].reduce(function(newArray,item){if(id!==item.id)newArray.push(item);return newArray},[])}return true}return{_triggerAll:triggerAll,reject:reject,setRejectContext:setRejectContext,then:then}}module.exports=Promise},{"./helpers/id":1,"./helpers/isFunction":2}],5:[function(require,module,exports){(function(global){var Promise=require("./promise");var toArray=require("./helpers/toArray");function Provent(elements,event){if(!event)throw new Error("You must choose an event");var promise=Promise();var handler;if(elements.length)elements=toArray(elements);else elements=[elements];if(!elements.length)return;elements.forEach(function(element){element.addEventListener(event,handler=function(){promise._triggerAll.call(promise,toArray(arguments),this)})});return{initial:true,then:promise.then,reject:promise.setRejectContext({elements:elements,event:event,handler:handler})}}global.Provent=Provent;module.exports=Provent}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./helpers/toArray":3,"./promise":4}]},{},[5]); +//# sourceMappingURL=dist/provent.min.js.map \ No newline at end of file diff --git a/dist/provent.min.js.map b/dist/provent.min.js.map new file mode 100644 index 0000000..8f4ef34 --- /dev/null +++ b/dist/provent.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dist/provent.min.js","sources":["dist/provent.js"],"names":["e","t","n","r","s","o","u","a","require","i","f","Error","code","l","exports","call","length",1,"module","Date","Math","random","toString","substring",2,"toCheck",3,"toArray","arrayLike","Array","prototype","slice",4,"isFunction","Promise","callbacks","callbackReturn","reject","then","id","callback","callbackId","this","push","bind","triggerAll","params","context","forEach","triggerCallback","index","apply","setRejectContext","removeThenCallback","elements","element","removeEventListener","event","handler","cbId","reduce","newArray","item","_triggerAll","./helpers/id","./helpers/isFunction",5,"global","Provent","promise","addEventListener","arguments","initial","self","window","./helpers/toArray","./promise"],"mappings":"CAAA,QAAUA,GAAEC,EAAEC,EAAEC,GAAG,QAASC,GAAEC,EAAEC,GAAG,IAAIJ,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,GAAIE,SAASC,UAAS,YAAYA,OAAQ,KAAIF,GAAGC,EAAE,MAAOA,GAAEF,GAAG,EAAG,IAAGI,EAAE,MAAOA,GAAEJ,GAAG,EAAG,IAAIK,GAAE,GAAIC,OAAM,uBAAuBN,EAAE,IAAK,MAAMK,GAAEE,KAAK,mBAAmBF,EAAE,GAAIG,GAAEX,EAAEG,IAAIS,WAAYb,GAAEI,GAAG,GAAGU,KAAKF,EAAEC,QAAQ,SAASd,GAAG,GAAIE,GAAED,EAAEI,GAAG,GAAGL,EAAG,OAAOI,GAAEF,EAAEA,EAAEF,IAAIa,EAAEA,EAAEC,QAAQd,EAAEC,EAAEC,EAAEC,GAAG,MAAOD,GAAEG,GAAGS,QAAQ,GAAIL,SAASD,UAAS,YAAYA,OAAQ,KAAI,GAAIH,GAAE,EAAEA,EAAEF,EAAEa,OAAOX,IAAID,EAAED,EAAEE,GAAI,OAAOD,MAAKa,GAAG,SAAST,QAAQU,OAAOJ,SACvdI,OAAOJ,QAAU,WACf,QAAS,GAAIK,MAAOC,KAAKC,UAAUC,SAAS,IAAIC,UAAU,EAAE,UAGxDC,GA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E,YAAalB,WACbR,OAAQA,OACRe,iBAAkBA,iBAClBd,KAAMA,MAKVpB,OAAOJ,QAAUoB,UAEd8B,eAAe,EAAEC,uBAAuB,IAAIC,GAAG,SAAS1D,QAAQU,OAAOJ,UAC1E,SAAWqD,QACX,GAAIjC,SAAU1B,QAAQ,YACtB,IAAImB,SAAUnB,QAAQ,oBAEtB,SAAS4D,SAAQd,SAAUG,OACzB,IAAIA,MAAO,KAAM,IAAI9C,OAAM,2BAE3B,IAAI0D,SAAUnC,SACd,IAAIwB,QAEJ,IAAGJ,SAAStC,OAAQsC,SAAW3B,QAAQ2B,cAClCA,WAAYA,SAGjB,KAAIA,SAAStC,OAAQ,MAErBsC,UAASN,QAAQ,SAASO,SACxBA,QAAQe,iBAAiBb,MAAOC,QAAU,WACxCW,QAAQN,YAAYhD,KAAKsD,QAAS1C,QAAQ4C,WAAY7B,SAI1D,QACE8B,QAAS,KACTlC,KAAM+B,QAAQ/B,KACdD,OAAQgC,QAAQjB,kBACdE,SAAUA,SACVG,MAAOA,MACPC,QAASA,WAKfS,OAAOC,QAAUA,OAEjBlD,QAAOJ,QAAUsD,UAEdrD,KAAK2B,WAAYyB,UAAW,YAAcA,aAAgBM,QAAS,YAAcA,WAAcC,UAAW,YAAcA,aACxHC,oBAAoB,EAAEC,YAAY,SAAS"} \ No newline at end of file diff --git a/package.json b/package.json index 3fa5549..f66ecae 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "main": "index.js", "scripts": { "test": "karma start test.conf.js", - "watch": "watchify src/provent.js -o dist/provent.js -v" + "watch": "watchify src/provent.js -o dist/provent.js -v", + "build": "uglifyjs dist/provent.js -o dist/provent.min.js --source-map dist/provent.min.js.map" }, "keywords": [ "promises", @@ -25,6 +26,7 @@ "karma-jasmine": "^0.3.6", "karma-phantomjs-launcher": "^0.2.1", "phantomjs": "^1.9.18", + "uglify-js": "^2.4.24", "watchify": "^3.4.0" } }