openwebf / mercury

A library with integrated JavaScript engine and extension utils for Flutter Apps.
Apache License 2.0
12 stars 3 forks source link

Add an global API for the EventTarget registration #9

Open andycall opened 8 months ago

andycall commented 8 months ago

From this point forward, the custom EventTarget will be tied to the JavaScript className to bridge JavaScript and Dart.

However, some front-end bundling tools might alter the JavaScript className, shortening it for optimization purposes.

If plugin developers use these bundling tools and inadvertently modify the ClassName in their codes, unexpected bugs could occur.

We need a more explicit approach for our EventTarget registration. For example:

class YourEventTargetName extends EventTarget {}
mercury.defineEventTarget('YourEventTargetName', YourEventTargetName);