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: compatible with svelte by default #36

Open
Fyzu opened this issue Jan 18, 2022 · 1 comment
Open

feat: compatible with svelte by default #36

Fyzu opened this issue Jan 18, 2022 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@Fyzu
Copy link
Collaborator

Fyzu commented Jan 18, 2022

Frp almost completely compatible with svelte, except for a moment with a subscription.

Svelte uses simple store contract.

type Store = { subscribe: (subscription: (value: any) => void) => (() => void), set?: (value: any) => void }

It seems to me that you can make a separate method for subscribing for a Time like .watch(time => {}) for internal usage, and adopt subscribe to .subscribe(value => {}).

This way we will get compatibility with svelte and it will be more understandable for users who want to work with frp as a reactive library.

@Fyzu Fyzu assigned Fyzu and raveclassic and unassigned Fyzu Jan 18, 2022
@raveclassic
Copy link
Owner

raveclassic commented Jan 19, 2022

I'm afraid this diverges from the main idea of change propagation in the lib - don't propagate values, propagate changes.
We also already have a standard-compatible integration with other reactive libs - Symbol.observable. It seems to me a better way would be for svelte to implement integration with Symbol.observable instead of requiring some specific interface. Moreover, such interface will most likely confuse the users of the lib - when they see the "conventional" subscribe method with a signature saying it propagates values, they'll definitely go this way by habit and ultimately miss all optimizations (skip duplicates, diamond shape etc.).

On the other hand, integration with popular libraries is a right direction, so I think it's better to keep this conversation open until we have some other feedback and/or feature requires for integrating with svelte and other libraries.

@Fyzu Fyzu added the enhancement New feature or request label Jan 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants