-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
1 lines (1 loc) · 1.31 KB
/
index.js
1
!function(n,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("Oni",[],t):"object"==typeof exports?exports.Oni=t():n.Oni=t()}(this,(()=>(()=>{"use strict";var n={};return(()=>{var t=n;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(n,t){var r=[],i=new Set,a=e(n),c=function(){return a},u=function(n){if(n.call)return i.add(n),function(){i.delete(n)}},f=function(n,t){return r.push({action:n,payload:t}),new Promise((function(e){return o((function(o){return l({action:n,payload:t},e)}))}))},d=function(n){u((function(t,e){var o=e.action,r=e.payload;o in n&&n[o].call(null,t,{action:o,payload:r})}))},l=function(n,e){var o=n.action,l=n.payload,s=void 0===l?{}:l;r.forEach((function(n){var e=n.action,o=n.payload,r=void 0===o?{}:o;if(e in t){var i=t[e].call(null,a,r,{getState:c,subscribe:u,dispatch:f,patternMatch:d});Object.assign(a,i)}else console.log("[Oni] Error -> No action [ ".concat(e," ] found."))})),r.length&&(i.forEach((function(n){return n(a,{action:o,payload:s})})),r=[]),e(a)};return{getState:c,subscribe:u,dispatch:f,patternMatch:d,destroy:function(){return i.clear()}}};var e=function(n){return JSON.parse(JSON.stringify(n))},o="undefined"==typeof window?function(n){return n()}:function(n){return requestAnimationFrame(n)}})(),n})()));