Skip to content

Commit

Permalink
fix: IE9/10/11 shim for CustomEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveVanOpstal committed Jul 27, 2016
1 parent 9f0365e commit 25af788
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions config/shims_for_IE.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// CustomEvent (IE9/10/11)

try {
new window.CustomEvent("test");
} catch(e) {
var CustomEvent = function(event, params) {
var evt;
params = params || {
bubbles: false,
cancelable: false,
detail: undefined
};

evt = document.createEvent("CustomEvent");
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
return evt;
};

CustomEvent.prototype = window.Event.prototype;
window.CustomEvent = CustomEvent; // expose definition to window
}
2 changes: 1 addition & 1 deletion config/webpack/client/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = webpackMerge(commonConfig, {
metadata: METADATA,
devtool: 'source-map',

entry: {main: ['./config/spec-imports'].concat(glob.sync('./src/client/**/*.spec.ts'))},
entry: {main: ['./config/spec-imports', './config/shims_for_IE.js'].concat(glob.sync('./src/client/**/*.spec.ts'))},

output: {path: helpers.root('dist/spec/client'), filename: '[name].spec.js'},

Expand Down

0 comments on commit 25af788

Please sign in to comment.