-
Notifications
You must be signed in to change notification settings - Fork 27
Description
Currently Navigator accepts a listeners object with callbacks, which is a pattern that is very different from the one you would typically expect e.g. on{event} or addEventListener/removeEventListener. Bear in mind there are constraints because we must handle iframes, and cannot handle events as standard events e.g. you cannot preventDefault() in an iframe from the host app so we cannot really be consistent with the expected patterns. See #197 or #20
Anyways, having peripherals has an object passed to Navigator on init also has significant caveats. In a reactive app for instance, these listeners becomes a de-facto dependency of Navigator, which means if it changes because it depends on states, Navigator is re-mounted. This means it could be reloaded on every position change…
So you may just ignore it as a dependency and use a stateless cache transforming these states to mutable refs to get around states becoming stale in the Navigator, but it is not pretty, and linting will let you know.
There has been quick private discussions about making them more stereotypical in the past. But we did not have an issue. Let’s hope it can bring some interest onto the topic so that we can collect feedback, inputs and ideas.