if (typeof CustomEvent === 'undefined') { CustomEvent = function () { } } if (typeof Set == 'undefined') { // very simple polyfill Set = function () { this.values = []; }; Set.prototype.has = function (value) { return this.values.indexOf(value) !== -1; }; Set.prototype.add = function (value) { this.values.push(value); }; }