vue-window-size
Advanced tools
Comparing version
@@ -1,41 +0,1 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: !0 }); | ||
var e, | ||
i = require('vue-demi'), | ||
n = require('window-resize-subject'), | ||
t = 'undefined' != typeof window, | ||
r = function (e) { | ||
return null != e ? e : t ? window.innerWidth : 0; | ||
}, | ||
u = function (e) { | ||
return null != e ? e : t ? window.innerHeight : 0; | ||
}, | ||
o = (function (e) { | ||
var n, | ||
t = i.reactive({ | ||
width: r(null == n ? void 0 : n.width), | ||
height: u(null == n ? void 0 : n.height), | ||
}); | ||
return ( | ||
e() | ||
.addObserver('composition-api', function (e) { | ||
var i = e.width, | ||
n = e.height; | ||
(t.width = i), (t.height = n); | ||
}) | ||
.subscribe(), | ||
function () { | ||
return { | ||
width: i.computed(function () { | ||
return t.width; | ||
}), | ||
height: i.computed(function () { | ||
return t.height; | ||
}), | ||
}; | ||
} | ||
); | ||
})(function () { | ||
return e || (e = new n.WindowResizeSubject()), e; | ||
}); | ||
exports.useWindowSize = o; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,i=require("vue-demi"),n=require("window-resize-subject"),t="undefined"!=typeof window,u=function(e){return null!=e?e:t?window.innerWidth:0},r=function(e){return null!=e?e:t?window.innerHeight:0},o=function(e){var n,t=0,o=e(),d=i.reactive({width:u(null==n?void 0:n.width),height:r(null==n?void 0:n.height)});o.addObserver("composition-api",(function(e){var i=e.width,n=e.height;d.width=i,d.height=n}));return function(){return 0===t&&o.subscribe(),++t,i.onUnmounted((function(){0===(t=Math.max(t-1,0))&&o.unsubscribe()})),{width:i.computed((function(){return d.width})),height:i.computed((function(){return d.height}))}}}((function(){return e||(e=new n.WindowResizeSubject),e}));exports.useWindowSize=o; |
@@ -1,69 +0,1 @@ | ||
'use strict'; | ||
Object.defineProperty(exports, '__esModule', { value: !0 }); | ||
var i, | ||
e, | ||
n = require('vue-demi'), | ||
t = require('window-resize-subject'), | ||
u = 'undefined' != typeof window, | ||
r = function (i) { | ||
return null != i ? i : u ? window.innerWidth : 0; | ||
}, | ||
o = function (i) { | ||
return null != i ? i : u ? window.innerHeight : 0; | ||
}, | ||
d = function (i) { | ||
var e, | ||
t = n.reactive({ | ||
width: r(null == e ? void 0 : e.width), | ||
height: o(null == e ? void 0 : e.height), | ||
}); | ||
return ( | ||
i | ||
.addObserver('option-api', function (i) { | ||
var e = i.width, | ||
n = i.height; | ||
(t.width = e), (t.height = n); | ||
}) | ||
.subscribe(), | ||
{ | ||
computed: { | ||
windowWidth: function () { | ||
return t.width; | ||
}, | ||
windowHeight: function () { | ||
return t.height; | ||
}, | ||
}, | ||
} | ||
); | ||
}, | ||
s = function () { | ||
return i || (i = new t.WindowResizeSubject()), i; | ||
}, | ||
c = function () { | ||
return e || (e = d(s())), e; | ||
}, | ||
w = (function (i) { | ||
return { | ||
setDelay: function (e) { | ||
i().setDelay(e); | ||
}, | ||
init: function () { | ||
i().subscribe(); | ||
}, | ||
destroy: function () { | ||
i().unsubscribe(); | ||
}, | ||
}; | ||
})(s); | ||
var h = { | ||
install: function (i, e) { | ||
var n = (void 0 === e ? {} : e).delay, | ||
t = void 0 === n ? 33 : n, | ||
u = c(); | ||
s().setDelay(t), i.mixin({ mixins: [u] }); | ||
}, | ||
}; | ||
(exports.VueWindowSizePlugin = h), | ||
(exports.vueWindowSizeAPI = w), | ||
(exports.vueWindowSizeMixin = c); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var i,e,n=require("vue-demi"),t=require("window-resize-subject"),u="undefined"!=typeof window,r=function(i){return null!=i?i:u?window.innerWidth:0},o=function(i){return null!=i?i:u?window.innerHeight:0},d=function(i){var e,t=n.reactive({width:r(null==e?void 0:e.width),height:o(null==e?void 0:e.height)});return i().addObserver("option-api",(function(i){var e=i.width,n=i.height;t.width=e,t.height=n})).subscribe(),{computed:{windowWidth:function(){return t.width},windowHeight:function(){return t.height}}}},c=function(){return i||(i=new t.WindowResizeSubject),i},s=function(){return e||(e=d(c)),e},w=function(i){return{config:function(e){"number"==typeof e.delay&&i().setDelay(e.delay)},init:function(){i().subscribe()},destroy:function(){i().unsubscribe()}}}(c);var h={install:function(i,e){var n=(void 0===e?{}:e).delay,t=void 0===n?33:n,u=s();c().setDelay(t),i.mixin({mixins:[u]})}};exports.VueWindowSizePlugin=h,exports.vueWindowSizeAPI=w,exports.vueWindowSizeMixin=s; |
@@ -8,5 +8,9 @@ declare type Mixin = { | ||
declare type Config = { | ||
delay?: number; | ||
}; | ||
declare const vueWindowSizeMixin: () => Mixin; | ||
declare const vueWindowSizeAPI: { | ||
setDelay(delay: number): void; | ||
config(config: Config): void; | ||
init(): void; | ||
@@ -38,11 +42,9 @@ destroy(): void; | ||
} | ||
declare type VueWindowSizeOption = { | ||
delay?: number; | ||
}; | ||
declare type VueWindowSizePluginOption = Config; | ||
export { | ||
VueWindowSizeOption, | ||
VueWindowSizePlugin, | ||
VueWindowSizePluginOption, | ||
vueWindowSizeAPI, | ||
vueWindowSizeMixin, | ||
}; |
{ | ||
"name": "vue-window-size", | ||
"version": "1.0.0-4", | ||
"version": "1.0.0-5", | ||
"description": "Reactivity window size for Vue.js.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
8343
-8.64%59
-63.35%4
100%