It will be a useful feature, to let method subscribe take a second optional parameter - this context for the notification, so the client won't need to rely on bind for the class, and write the code like this:
event.subscribe(onEvent, this); // pass in the right call context
onEvent() {
// event-handling class method
// 'this' context is set correctly
}
It will be a useful feature, to let method
subscribe
take a second optional parameter -this
context for the notification, so the client won't need to rely onbind
for the class, and write the code like this:Currently we need to write it like this:
which is somewhat less friendly.
Thanks to @babakks for the idea.