Think more about this. The main reason I added this was so it would be obvious when you misconfigure your callback. For example if you pass in a non-existent callback id, then the promise variable will return undefined. Then promise.timeoutID will throw an error because you can't get a property of undefined.
We should add an explicit error message for when typeof promise === 'undefined'.
Then decide if we should actually log an error and alert(), or if we should let the exception bubble up.
Think more about this. The main reason I added this was so it would be obvious when you misconfigure your callback. For example if you pass in a non-existent callback id, then the
promise
variable will return undefined. Thenpromise.timeoutID
will throw an error because you can't get a property of undefined.We should add an explicit error message for when
typeof promise === 'undefined'
.Then decide if we should actually log an error and alert(), or if we should let the exception bubble up.