UNPKG

qoopido.nucleus

Version:

Lightweight, atomic and modular JavaScript utility library that strongly encourages the creation and usage of small yet flexible, reusable and easily maintainable modules.

4 lines (3 loc) 1.38 kB
/**! Qoopido.nucleus 3.2.15 | http://nucleus.qoopido.com | (c) 2021 Dirk Lueth */ !function(e,t,n){"use strict";provide(["/demand/function/iterate"],(function(i){var r,a,c="polyfill/window/matchmedia",s={},o=0;function d(){var e,t,n,r;i(s,(function(i,a){if((e=a.mql).matches!==a.check())for(t={currentTarget:e,matches:e.matches,media:e.media,srcElement:e,target:e,timestamp:+new Date,type:"change"},n=0;r=a.listener[n];n++)r.call(e,t)}))}function u(e){var t=this,n=o+1,i=[];t.index=String(n),t.source="@media "+e+' { [nucleus-source="'+c+'"] { z-index: '+n+"; } }",t.listener=i,t.mql={matches:!1,media:e,addListener:function(e){e&&i.push(e)},removeListener:function(e){for(var t,n=0;t=i[n];n++)if(t===e){i.splice(n,1);break}}},o++,t.check()}return u.prototype={check:function(){var e,t=this;return r.textContent=t.source,e=String(n(r).zIndex)===t.index,r.textContent="",t.mql.matches=e}},"matchMedia"in e||(a=t.getElementsByTagName("script")[0],(r=t.createElement("style")).type="text/css",r.setAttribute("nucleus-source",c),r.setAttribute("style","display: none; position: absolute; width: 0; height: 0; overflow: hidden;"),a.parentNode.insertBefore(r,a),e.addEventListener("resize",d),e.addEventListener("orientationchange",d),e.matchMedia=function(e){return(s[e]||(s[e]=new u(e))).mql}),e.matchMedia}))}(this,document,getComputedStyle); //# sourceMappingURL=matchmedia.js.map