diff --git a/dist/main.js b/dist/main.js index 82e1540..74567e4 100644 --- a/dist/main.js +++ b/dist/main.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Derekstrap=e():t.Derekstrap=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=0)}([function(t,e,n){"use strict";n.r(e),n.d(e,"debounce",(function(){return r})),n.d(e,"Derekstrap",(function(){return a})),n.d(e,"Breakpoints",(function(){return u}));var r=function(t,e,n){var r;return function(){var i=this,o=arguments,u=function(){r=null,n||t.apply(i,o)},a=n&&!r;clearTimeout(r),r=setTimeout(u,e),a&&t.apply(i,o)}};var i=function(){document.documentElement.setAttribute("data-useragent",navigator.userAgent)},o={breakpoints:{},current:[],currentBreakpoint:"",init:function(t){this.breakpoints=t,this.currentBreakpoint=this.getCurrent(),this.current=this.get(),window.addEventListener("resize",this.eventEmitter)},getCurrent:function(){var t=Object.entries(this.breakpoints).reduce((function(t,e){return t&&!window.matchMedia("(min-width:"+t[1]+")").matches&&(t=null),window.matchMedia("(min-width:"+e[1]+")").matches&&t&&Number(t[1].replace(/\D/g,"")) { const newBreakpoint = Breakpoints.getCurrent(); if (newBreakpoint !== Breakpoints.currentBreakpoint) { + const oldBreakpoint = Breakpoints.currentBreakpoint; + Breakpoints.currentBreakpoint = newBreakpoint; + Breakpoints.current = Breakpoints.get(); + window.dispatchEvent(new CustomEvent('breakpointChange', { detail: { breakpoint: newBreakpoint, - lastBreakpoint: Breakpoints.currentBreakpoint + breakpoints: breakpoints.current, + lastBreakpoint: oldBreakpoint } })); - Breakpoints.currentBreakpoint = newBreakpoint; - Breakpoints.current = Breakpoints.get(); } }, 50), };