vue-window-size
Advanced tools
Comparing version 0.4.0 to 0.5.0-0
@@ -1,1 +0,1 @@ | ||
"use strict";function _interopDefault(i){return i&&"object"==typeof i&&"default"in i?i.default:i}Object.defineProperty(exports,"__esModule",{value:!0});var Vue=_interopDefault(require("vue")),WindowSize=function(){function i(i){var e=void 0===i?{}:i,t=e.defaults,n=void 0===t?{width:800,height:600}:t,o=e.delay,d=void 0===o?50:o;this._width=n.width,this._height=n.height,this._delay=d,this._initialized=!1,this._handler=this._handleResize.bind(this)}return i.prototype._handleResize=function(){var i=this;clearTimeout(this._timer),this._timer=setTimeout(function(){i.update()},this._delay)},Object.defineProperty(i.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),i.prototype.update=function(){this._width=window.innerWidth,this._height=window.innerHeight},i.prototype.setDelay=function(i){this._delay=i},i.prototype.init=function(){return"undefined"==typeof window||this.initialized||(this.update(),window.addEventListener("resize",this._handler),this._initialized=!0),this},i.prototype.destroy=function(){return this.initialized&&(window.removeEventListener("resize",this._handler),this._initialized=!1),this},i}(),windowSize=(new WindowSize).init(),vm="function"==typeof Vue.observable?Vue.observable({windowSize:windowSize}):new Vue({data:{windowSize:windowSize}}),mixin={computed:{windowWidth:function(){return vm.windowSize.width},windowHeight:function(){return vm.windowSize.height}}},vueWindowSizeMixin=mixin,vueWindowSize={setDelay:function(i){windowSize.setDelay(i)},init:function(){windowSize.init()},destroy:function(){windowSize.destroy()}},state={installed:!1};function install(i,e){var t=(void 0===e?{}:e).delay,n=void 0===t?50:t;state.installed||(state.installed=!0,windowSize.setDelay(n),i.mixin({mixins:[mixin]}))}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){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; |
@@ -1,1 +0,1 @@ | ||
!function(e,i){"object"==typeof exports&&"undefined"!=typeof module?i(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],i):i(((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,i){"use strict";function t(e){var i=void 0===e?{}:e,t=i.defaults,n=void 0===t?{width:800,height:600}:t,o=i.delay,d=void 0===o?50:o;this._width=n.width,this._height=n.height,this._delay=d,this._initialized=!1,this._handler=this._handleResize.bind(this)}i=i&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i;var o=(new(t.prototype._handleResize=function(){var e=this;clearTimeout(this._timer),this._timer=setTimeout(function(){e.update()},this._delay)},Object.defineProperty(t.prototype,"width",{get:function(){return this._width},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"initialized",{get:function(){return this._initialized},enumerable:!1,configurable:!0}),t.prototype.update=function(){this._width=window.innerWidth,this._height=window.innerHeight},t.prototype.setDelay=function(e){this._delay=e},t.prototype.init=function(){return"undefined"==typeof window||this.initialized||(this.update(),window.addEventListener("resize",this._handler),this._initialized=!0),this},t.prototype.destroy=function(){return this.initialized&&(window.removeEventListener("resize",this._handler),this._initialized=!1),this},t)).init(),n="function"==typeof i.observable?i.observable({windowSize:o}):new i({data:{windowSize:o}}),d={computed:{windowWidth:function(){return n.windowSize.width},windowHeight:function(){return n.windowSize.height}}},u=d,r={setDelay:function(e){o.setDelay(e)},init:function(){o.init()},destroy:function(){o.destroy()}},l={installed:!1};var s={install:function(e,i){var t=(void 0===i?{}:i).delay,n=void 0===t?50:t;l.installed||(l.installed=!0,o.setDelay(n),e.mixin({mixins:[d]}))}},h=null;"undefined"!=typeof window?h=window.Vue:"undefined"!=typeof global&&(h=global.Vue),h&&h.use(s),e.default=s,e.vueWindowSize=r,e.vueWindowSizeMixin=u,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){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})}); |
{ | ||
"name": "vue-window-size", | ||
"version": "0.4.0", | ||
"version": "0.5.0-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
10776
46