|
|
@@ -1,6 +1,7 @@
|
|
|
import extend from "./extend";
|
|
|
import window from "../global/window";
|
|
|
import DependencyLib from "./inputmask.dependencyLib";
|
|
|
+import canUseDOM from "../canUseDOM";
|
|
|
|
|
|
export {on, off, trigger, Event};
|
|
|
|
|
|
@@ -12,13 +13,15 @@ let Event;
|
|
|
if (typeof window.CustomEvent === "function") {
|
|
|
Event = window.CustomEvent;
|
|
|
} else {
|
|
|
- Event = function (event, params) {
|
|
|
- params = params || {bubbles: false, cancelable: false, detail: undefined};
|
|
|
- var evt = document.createEvent("CustomEvent");
|
|
|
- evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
|
- return evt;
|
|
|
- };
|
|
|
- Event.prototype = window.Event.prototype;
|
|
|
+ if (canUseDOM) {
|
|
|
+ Event = function (event, params) {
|
|
|
+ params = params || {bubbles: false, cancelable: false, detail: undefined};
|
|
|
+ var evt = document.createEvent("CustomEvent");
|
|
|
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
|
|
|
+ return evt;
|
|
|
+ };
|
|
|
+ Event.prototype = window.Event.prototype;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|