I'm using ko.postbox together with ko-amd-helpers. When I reload a module with subscriptions that are initialized I ran into the problem that the handler linked to the subscription is executed in the global context. I expected that the handler was executed in the target-context.
I solved this issue by changing line 53 of knockout-postbox.js from
'action(current.value);' with 'action.call(target, current.value);'
I don't know if this change breaks any other code of your javascript since I'm using only using the basic functionalities of knockout-postbox.js (ko.postbox.subscribe and ko.postbox.publish).
Hello,
I'm using ko.postbox together with ko-amd-helpers. When I reload a module with subscriptions that are initialized I ran into the problem that the handler linked to the subscription is executed in the global context. I expected that the handler was executed in the target-context.
I solved this issue by changing line 53 of knockout-postbox.js from 'action(current.value);' with 'action.call(target, current.value);'
I don't know if this change breaks any other code of your javascript since I'm using only using the basic functionalities of knockout-postbox.js (ko.postbox.subscribe and ko.postbox.publish).
kind regards,
Koen