Skip to content

Commit a03f3ac

Browse files
try register in window if possible
1 parent 64b41b4 commit a03f3ac

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/controller.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@
99
*/
1010

1111

12-
(function (root, factory) {
12+
(function (global, factory) {
1313
if (typeof define === 'function' && define.amd) {
1414
// AMD. Register as an anonymous module.
1515
define([], factory);
16-
} else if (typeof module !== "undefined" && module.exports) {
16+
} else if (typeof module !== 'undefined' && module.exports) {
1717
// CommonJS/Node module
1818
module.exports = factory();
1919
} else {
2020
// Browser globals
21-
root.Controller = factory();
21+
global.Controller = factory();
2222
}
23-
}(this, function () {
23+
}(typeof window !== 'undefined' ? window : this, function () {
2424

2525
/**
2626
* @type {Object.<string, Function>}
@@ -68,7 +68,7 @@
6868
*/
6969
static singleBind(element) {
7070
if (!(element instanceof Element)) {
71-
throw new Error(`The element to be binding must be instance of Element, now it is "${typeof element}".`);
71+
throw new Error(`The element to be binding must be instance of Element, now it's "${typeof element}".`);
7272
}
7373

7474
if (!element.getAttribute('data-control')) {
@@ -97,7 +97,7 @@
9797
*/
9898
static bind(element) {
9999
if (!(element instanceof Element)) {
100-
throw new Error(`The element to be binding must be instance of Element, now it is "${typeof element}".`);
100+
throw new Error(`The element to be binding must be instance of Element, now it's "${typeof element}".`);
101101
}
102102

103103
let binded = Controller.singleBind(element);

0 commit comments

Comments
 (0)