|
|
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.spruce=t()}(this,function(){var e=function(t,r){return Object.keys(t).forEach(function(n){Object.getPrototypeOf(t[n])===Object.prototype&&(t[n]=e(t[n],r))}),new Proxy(t,{set:function(t,n,o){return"object"==typeof o&&(o=e(o,r)),r(n,t[n]=o),!0}})},t={stores:{},subscribers:[],start:function(){try{var t=this;return Promise.resolve(new Promise(function(e){"loading"==document.readyState?document.addEventListener("DOMContentLoaded",e):e()})).then(function(){document.querySelectorAll("[x-subscribe]").forEach(function(e){e.setAttribute("x-init",function(e){var t="$store = Spruce.subscribe($el)";return e.hasAttribute("x-init")&&(t=t+"; "+e.getAttribute("x-init")),t}(e)),e.removeAttribute("x-subscribe")}),t.stores=e(t.stores,function(e,r){t.updateSubscribers(e,r)})})}catch(e){return Promise.reject(e)}},store:function(e,t){void 0===t&&(t={}),this.stores[e]||(this.stores[e]=t)},subscribe:function(e){return this.subscribers.push(e),this.stores},updateSubscribers:function(e,t){this.subscribers.forEach(function(r){void 0!==r.__x&&(r.__x.$data.spruce=[e,t])})}},r=window.deferLoadingAlpine||function(e){e()};return window.deferLoadingAlpine=function(e){window.Spruce=t,window.Spruce.start(),r(e)},t});
|
|
|
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.spruce=t()}(this,function(){var e=function(t,r){return Object.keys(t).forEach(function(n){Object.getPrototypeOf(t[n])===Object.prototype&&(t[n]=e(t[n],r))}),new Proxy(t,{set:function(t,n,o){return"object"==typeof o&&(o=e(o,r)),r(n,t[n]=o),!0}})},t={stores:{},subscribers:[],start:function(){try{var t=this;return Promise.resolve(new Promise(function(e){"loading"==document.readyState?document.addEventListener("DOMContentLoaded",e):e()})).then(function(){document.querySelectorAll("[x-subscribe]").forEach(function(e){e.setAttribute("x-init",function(e){var t="$store = Spruce.subscribe($el)";return e.hasAttribute("x-init")&&(t=t+"; "+e.getAttribute("x-init")),t}(e)),e.removeAttribute("x-subscribe")}),t.stores=e(t.stores,function(e,r){t.updateSubscribers(e,r)}),window.Spruce||(window.Spruce=t)})}catch(e){return Promise.reject(e)}},store:function(e,t){void 0===t&&(t={}),this.stores[e]||(this.stores[e]=t)},subscribe:function(e){return this.subscribers.push(e),this.stores},updateSubscribers:function(e,t){this.subscribers.forEach(function(r){void 0!==r.__x&&(r.__x.$data.spruce=[e,t])})}},r=window.deferLoadingAlpine||function(e){e()};return window.deferLoadingAlpine=function(e){window.Spruce=t,window.Spruce.start(),r(e)},t});
|