Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(navigation): Allow to listen for active navigation changes #987

Merged
merged 1 commit into from
Jun 14, 2024

Conversation

susnux
Copy link
Contributor

@susnux susnux commented Jun 14, 2024

This adds the native EventTarget class to the Navigation allowing to add listeners to it. Allowing to dispatch the updateActive event when the active navigation changed.

The idea is to make it reactive in a native / framework agnostic way.

@susnux susnux added enhancement New feature or request 3. to review labels Jun 14, 2024
@susnux susnux requested review from skjnldsv, Pytal and ShGKme June 14, 2024 11:18
@susnux susnux force-pushed the feat/allow-listening-active-view branch from 98e7d76 to 808ab7c Compare June 14, 2024 11:18
Copy link

codecov bot commented Jun 14, 2024

Bundle Report

Changes will increase total bundle size by 1.63kB ⬆️

Bundle name Size Change
@nextcloud/files-esm 95.78kB 800 bytes ⬆️
@nextcloud/files-esm-cjs 96.87kB 828 bytes ⬆️

@skjnldsv
Copy link
Contributor

The idea is to make it reactive in a native / framework agnostic way.

Nice!
Though it seems a bit unknown for now, no?
Shall we add a bit more details like an example on the comments?

@susnux
Copy link
Contributor Author

susnux commented Jun 14, 2024

Though it seems a bit unknown for now, no?

In general it is now the same as with native JS / HTML element you can add / remove event listeners.

Shall we add a bit more details like an example on the comments?

I can add an example, yes :)

@susnux susnux force-pushed the feat/allow-listening-active-view branch from 808ab7c to 6b2dbbf Compare June 14, 2024 14:46
@susnux
Copy link
Contributor Author

susnux commented Jun 14, 2024

Examples added

This adds the native `EventTarget` class to the Navigation allowing to add listeners to it.
Allowing to dispatch the `updateActive` event when the active navigation changed.

The idea is to make it reactive in a native / framework agnostic way.

Signed-off-by: Ferdinand Thiessen <[email protected]>
@susnux susnux force-pushed the feat/allow-listening-active-view branch from 6b2dbbf to c046d93 Compare June 14, 2024 14:50
@susnux susnux merged commit f4d3188 into main Jun 14, 2024
17 checks passed
@susnux susnux deleted the feat/allow-listening-active-view branch June 14, 2024 16:16
@skjnldsv
Copy link
Contributor

skjnldsv commented Jul 3, 2024

Breaks stable28 & stable29 reactivity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants