engine icon indicating copy to clipboard operation
engine copied to clipboard

Event emitters with remote access cause an error if their subscribe method gets more than one argument

Open danielstro opened this issue 5 years ago • 1 comments

If I use a multi event emitter with allowRemoteAccess and I pass more than one argument to the subscribe method I get this error: Failed to execute 'postMessage' on 'Worker': function () { [native code] } could not be cloned. (specifically, the first argument is string & the second is a function). It seems that callMethod calls addOrRemoveListener only if there is only one argument and it's a function.

danielstro avatar Feb 11 '20 12:02 danielstro

Refs: https://github.com/wixplosives/engine/blob/efd9586a0fd8aac72fed5f71d817b048a75a87dc/packages/core/src/com/communication.ts#L720 https://github.com/wixplosives/engine/blob/efd9586a0fd8aac72fed5f71d817b048a75a87dc/packages/core/src/com/communication.ts#L199

AviVahl avatar May 08 '20 15:05 AviVahl