feat: route renderer events through Angular's EventManager - #177
feat: route renderer events through Angular's EventManager#177mukaschultze wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Routes NativeScript renderer events through Angular’s EventManager, enabling custom event plugins.
Changes:
- Adds and exports a default NativeScript event plugin.
- Lazily delegates renderer listeners through
EventManager. - Adds plugin routing and event behavior tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
packages/angular/src/lib/public_api.ts |
Exports the plugin. |
packages/angular/src/lib/nativescript.ts |
Registers event providers. |
packages/angular/src/lib/nativescript-renderer.ts |
Delegates listener registration. |
packages/angular/src/lib/nativescript-event-manager-plugin.ts |
Implements NativeScript event binding. |
apps/nativescript-demo-ng/src/tests/event-manager-plugin.spec.ts |
Tests plugin behavior and integration. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| return true; | ||
| } | ||
|
|
||
| addEventListener(element: unknown, eventName: string, handler: (data?: unknown) => void): VoidFunction { |
| this.fallbackEventPlugin ??= new NativeScriptEventManagerPlugin(); | ||
| return this.fallbackEventPlugin.addEventListener(target, eventName, modifiedCallback) as () => void; |
| // EventManager must be resolved lazily: eager injection would instantiate | ||
| // every EVENT_MANAGER_PLUGINS provider while the renderer factory's own DI | ||
| // record is still circular, breaking plugins that inject RendererFactory2. | ||
| private eventManager: EventManager | null | undefined; |
| } | ||
| target.on(eventName, handler); | ||
| if (eventName === View.loadedEvent && target.isLoaded) { | ||
| // we must create a new obervable here to ensure that the event goes through whatever zone patches are applied |
PR Checklist
What is the current behavior?
Nativescript Angular does not yet support angular's
EventManagerPluginWhat is the new behavior?
Support for
EventManagerPlugin, see https://angular.dev/guide/templates/event-listeners#extend-event-handling