vue-window-size
Advanced tools
Comparing version 0.5.0-0 to 0.5.0
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var Vue=_interopDefault(require("vue")),WindowResizeSubject=function(){function e(e){var t=(void 0===e?{}:e).delay,i=void 0===t?50:t;this._observers=new Map,this._subscribed=!1,this._delay=i,this._handler=this._handleResize.bind(this)}return e.prototype.addObserver=function(e,t){this._observers.set(e,t)},e.prototype.deleteObserver=function(e){this._observers.delete(e)},e.prototype.notifyObservers=function(t){this._observers.forEach(function(e){e(t)})},e.prototype.subscribe=function(){return"undefined"==typeof window||this._subscribed||(this._update(),window.addEventListener("resize",this._handler),window.addEventListener("orientationchange",this._handler),this._subscribed=!0),this},e.prototype.unsubscribe=function(){return this._subscribed&&(window.removeEventListener("resize",this._handler),window.removeEventListener("orientationchange",this._handler),this._subscribed=!1),this},e.prototype.setDelay=function(e){this._delay=e},e.prototype._update=function(){this.notifyObservers({width:window.innerWidth,height:window.innerHeight})},e.prototype._handleResize=function(){var e=this;clearTimeout(this._timer),this._timer=setTimeout(function(){e._update()},this._delay)},e}(),createInitailValue=function(){return{width:800,height:600}},createVm=function(){return"function"==typeof Vue.observable?Vue.observable(createInitailValue()):new Vue({data:createInitailValue()})},createMixin=function(e){var n=createVm();return e.addObserver("option",function(e){var t=e.width,i=e.height;n.width=t,n.height=i}),e.subscribe(),{computed:{windowWidth:function(){return n.width},windowHeight:function(){return n.height}}}},createPublicAPI=function(t){return{setDelay:function(e){t.setDelay(e)},init:function(){t.subscribe()},destroy:function(){t.unsubscribe()}}},subject=new WindowResizeSubject,vueWindowSizeMixin=createMixin(subject),vueWindowSize=createPublicAPI(subject),state={installed:!1};function install(e,t){var i=(void 0===t?{}:t).delay,n=void 0===i?50:i;state.installed||(state.installed=!0,subject.setDelay(n),e.mixin({mixins:[vueWindowSizeMixin]}))}var plugin={install:install},GlobalVue=null;"undefined"!=typeof window?GlobalVue=window.Vue:"undefined"!=typeof global&&(GlobalVue=global.Vue),GlobalVue&&GlobalVue.use(plugin),exports.default=plugin,exports.vueWindowSize=vueWindowSize,exports.vueWindowSizeMixin=vueWindowSizeMixin; | ||
"use strict";function _interopDefault(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var Vue=_interopDefault(require("vue")),WindowResizeSubject=function(){function e(e){var t=(void 0===e?{}:e).delay,i=void 0===t?50:t;this._observers=new Map,this._subscribed=!1,this._delay=i,this._handler=this._handleResize.bind(this)}return e.prototype.addObserver=function(e,t){return this._observers.set(e,t),this},e.prototype.deleteObserver=function(e){return this._observers.delete(e),this},e.prototype.notifyObservers=function(t){this._observers.forEach(function(e){e(t)})},e.prototype.subscribe=function(){return"undefined"==typeof window||this._subscribed||(this._update(),window.addEventListener("resize",this._handler),window.addEventListener("orientationchange",this._handler),this._subscribed=!0),this},e.prototype.unsubscribe=function(){return this._subscribed&&(window.removeEventListener("resize",this._handler),window.removeEventListener("orientationchange",this._handler),this._subscribed=!1),this},e.prototype.setDelay=function(e){this._delay=e},e.prototype._update=function(){this.notifyObservers({width:window.innerWidth,height:window.innerHeight})},e.prototype._handleResize=function(){var e=this;clearTimeout(this._timer),this._timer=setTimeout(function(){e._update()},this._delay)},e}(),createInitailValue=function(){return{width:800,height:600}},createVm=function(){return"function"==typeof Vue.observable?Vue.observable(createInitailValue()):new Vue({data:createInitailValue()})},createMixin=function(e){var n=createVm();return e.addObserver("option",function(e){var t=e.width,i=e.height;n.width=t,n.height=i}).subscribe(),{computed:{windowWidth:function(){return n.width},windowHeight:function(){return n.height}}}},createPublicAPI=function(t){return{setDelay:function(e){t.setDelay(e)},init:function(){t.subscribe()},destroy:function(){t.unsubscribe()}}},subject=new WindowResizeSubject,vueWindowSizeMixin=createMixin(subject),vueWindowSize=createPublicAPI(subject),state={installed:!1};function install(e,t){var i=(void 0===t?{}:t).delay,n=void 0===i?50:i;state.installed||(state.installed=!0,subject.setDelay(n),e.mixin({mixins:[vueWindowSizeMixin]}))}var plugin={install:install},GlobalVue=null;"undefined"!=typeof window?GlobalVue=window.Vue:"undefined"!=typeof global&&(GlobalVue=global.Vue),GlobalVue&&GlobalVue.use(plugin),exports.default=plugin,exports.vueWindowSize=vueWindowSize,exports.vueWindowSizeMixin=vueWindowSizeMixin; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).bundle=e.bundle||{},e.bundle.umd=e.bundle.umd||{},e.bundle.umd.js={}),e.Vue)}(this,function(e,t){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var i=(n.prototype.addObserver=function(e,t){this._observers.set(e,t)},n.prototype.deleteObserver=function(e){this._observers.delete(e)},n.prototype.notifyObservers=function(t){this._observers.forEach(function(e){e(t)})},n.prototype.subscribe=function(){return"undefined"==typeof window||this._subscribed||(this._update(),window.addEventListener("resize",this._handler),window.addEventListener("orientationchange",this._handler),this._subscribed=!0),this},n.prototype.unsubscribe=function(){return this._subscribed&&(window.removeEventListener("resize",this._handler),window.removeEventListener("orientationchange",this._handler),this._subscribed=!1),this},n.prototype.setDelay=function(e){this._delay=e},n.prototype._update=function(){this.notifyObservers({width:window.innerWidth,height:window.innerHeight})},n.prototype._handleResize=function(){var e=this;clearTimeout(this._timer),this._timer=setTimeout(function(){e._update()},this._delay)},n);function n(e){var t=(void 0===e?{}:e).delay,i=void 0===t?50:t;this._observers=new Map,this._subscribed=!1,this._delay=i,this._handler=this._handleResize.bind(this)}function o(){return{width:800,height:600}}var s,d,r,u=new i,h=(s=u,d="function"==typeof t.observable?t.observable(o()):new t({data:o()}),s.addObserver("option",function(e){var t=e.width,i=e.height;d.width=t,d.height=i}),s.subscribe(),{computed:{windowWidth:function(){return d.width},windowHeight:function(){return d.height}}}),a=(r=u,{setDelay:function(e){r.setDelay(e)},init:function(){r.subscribe()},destroy:function(){r.unsubscribe()}}),l={installed:!1};var f={install:function(e,t){var i=(void 0===t?{}:t).delay,n=void 0===i?50:i;l.installed||(l.installed=!0,u.setDelay(n),e.mixin({mixins:[h]}))}},b=null;"undefined"!=typeof window?b=window.Vue:"undefined"!=typeof global&&(b=global.Vue),b&&b.use(f),e.default=f,e.vueWindowSize=a,e.vueWindowSizeMixin=h,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).bundle=e.bundle||{},e.bundle.umd=e.bundle.umd||{},e.bundle.umd.js={}),e.Vue)}(this,function(e,t){"use strict";t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t;var i=(n.prototype.addObserver=function(e,t){return this._observers.set(e,t),this},n.prototype.deleteObserver=function(e){return this._observers.delete(e),this},n.prototype.notifyObservers=function(t){this._observers.forEach(function(e){e(t)})},n.prototype.subscribe=function(){return"undefined"==typeof window||this._subscribed||(this._update(),window.addEventListener("resize",this._handler),window.addEventListener("orientationchange",this._handler),this._subscribed=!0),this},n.prototype.unsubscribe=function(){return this._subscribed&&(window.removeEventListener("resize",this._handler),window.removeEventListener("orientationchange",this._handler),this._subscribed=!1),this},n.prototype.setDelay=function(e){this._delay=e},n.prototype._update=function(){this.notifyObservers({width:window.innerWidth,height:window.innerHeight})},n.prototype._handleResize=function(){var e=this;clearTimeout(this._timer),this._timer=setTimeout(function(){e._update()},this._delay)},n);function n(e){var t=(void 0===e?{}:e).delay,i=void 0===t?50:t;this._observers=new Map,this._subscribed=!1,this._delay=i,this._handler=this._handleResize.bind(this)}function o(){return{width:800,height:600}}var s,r,d,u=new i,h=(s=u,r="function"==typeof t.observable?t.observable(o()):new t({data:o()}),s.addObserver("option",function(e){var t=e.width,i=e.height;r.width=t,r.height=i}).subscribe(),{computed:{windowWidth:function(){return r.width},windowHeight:function(){return r.height}}}),a=(d=u,{setDelay:function(e){d.setDelay(e)},init:function(){d.subscribe()},destroy:function(){d.unsubscribe()}}),l={installed:!1};var f={install:function(e,t){var i=(void 0===t?{}:t).delay,n=void 0===i?50:i;l.installed||(l.installed=!0,u.setDelay(n),e.mixin({mixins:[h]}))}},b=null;"undefined"!=typeof window?b=window.Vue:"undefined"!=typeof global&&(b=global.Vue),b&&b.use(f),e.default=f,e.vueWindowSize=a,e.vueWindowSizeMixin=h,Object.defineProperty(e,"__esModule",{value:!0})}); |
{ | ||
"name": "vue-window-size", | ||
"version": "0.5.0-0", | ||
"version": "0.5.0", | ||
"description": "Reactivity window size for Vue.js.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.common.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10818
47