Skip to content

Commit 2240d97

Browse files
committed
[library_html5] Simplify JSEvent system. NFC
This change extracts a few helper function to make the JS event system smaller and more internally consistent. Firstly, we now use a single storage location for the event data pointer used in event callback. This is allocated on demand in `allocateEventStruct`. We then use a new `dispatchEvent` all the many loction that previously duplicated the event dispatching logic. In order to handler the 3 cases where we need to keep a copy of the last dispatched event we also have two new helpers: `getCachedEvent`, `cacheEvent`. These allocate separate copies of the last generated event, but only for the 3 event types where this is required.
1 parent dab8702 commit 2240d97

File tree

2 files changed

+131
-226
lines changed

2 files changed

+131
-226
lines changed

0 commit comments

Comments
 (0)