LearnNewsExamplesServices
Frontmatter
id668
titleTest if we can use port.addEventListener() after using port.start()
stateClosed
labels
enhancement
assigneestobiu
createdAtJun 5, 2020, 7:24 AM
updatedAtJun 6, 2020, 3:25 AM
githubUrlhttps://github.com/neomjs/neo/issues/668
authortobiu
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 6, 2020, 3:25 AM

Test if we can use port.addEventListener() after using port.start()

tobiu
tobiu commented on Jun 5, 2020, 7:24 AM

Got the feedback on Reddit that it should work after calling port.start().

This version works without calling start():

port.onmessage = me.onMessage.bind(me);

This version feels cleaner and more consistent to non shared workers

port.addEventListener('message', me.onMessage.bind(me), false);

If the change does work, I need to update the tutorial as well.

tobiu added the enhancement label on Jun 5, 2020, 7:24 AM
tobiu assigned to @tobiu on Jun 5, 2020, 7:24 AM
tobiu
tobiu Jun 5, 2020, 7:38 AM
tobiu
tobiu Jun 6, 2020, 3:25 AM

just sticking to port.onmessage = me.onMessage.bind(me);.

tobiu closed this issue on Jun 6, 2020, 3:25 AM