alloy 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -418,6 +418,10 @@ The 'redbg' and 'bigger' classes are shown below:
|
|
|
418
418
|
* @since 1.7.0
|
|
419
419
|
*/
|
|
420
420
|
addListener: function(proxy, type, callback) {
|
|
421
|
+
if (!proxy) {
|
|
422
|
+
throw new Error(`Trying to pass proxy, but proxy is null. Attempted to add event listener for type = "${type}"`);
|
|
423
|
+
}
|
|
424
|
+
|
|
421
425
|
if (!proxy.id) {
|
|
422
426
|
proxy.id = _.uniqueId('__trackId');
|
|
423
427
|
|
|
@@ -427,6 +431,11 @@ The 'redbg' and 'bigger' classes are shown below:
|
|
|
427
431
|
}
|
|
428
432
|
}
|
|
429
433
|
|
|
434
|
+
// Improve error reporting when passing something wrong to an event listener
|
|
435
|
+
if (typeof proxy.addEventListener !== 'function') {
|
|
436
|
+
throw new Error(`Passed proxy "${proxy.id}" is not a valid Alloy proxy. Attempted to add event listener for type = "${type}"`);
|
|
437
|
+
}
|
|
438
|
+
|
|
430
439
|
proxy.addEventListener(type, callback);
|
|
431
440
|
this.__events.push({
|
|
432
441
|
id: proxy.id,
|