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

An API to allow replacing observer implementation with alternative implementation #8884

Open
mitar opened this issue Oct 1, 2018 · 2 comments

Comments

@mitar
Copy link
Contributor

mitar commented Oct 1, 2018

What problem does this feature solve?

This is a followup to #4652. For integration of Vue with existing Tracker-based Meteor apps, one approach how to assure fur compatibility is to implement Tracker on top of observer implementation. This has been proven to work great with 2.x version and it just needed a bit more access to Vue observer internals than what was already available.

I would suggest that in 3.x there is a simple way to register an alternative Vue observer implementation. In this way 3rd party libraries could extend new Vue observer implementation with additional things and then register it back for Vue to use it.

What does the proposed API look like?

It could be something as simple as Vue.useReactivity(module). It would be on module's author to assure that the alternative implementation is compatible and works well with Vue.

@LinusBorg
Copy link
Member

I would suggest that in 3.x there is a simple way to register an alternative Vue observer implementation.

In Vue 3.0, we will indeed implement the new, proxy-based Observer implementation as an independent package, and also implement an alternative version which uses the getters/setters based Reactivity system from 2.0 (for IE compatibility)

So something like this will likely be possible, though the details are still under consideration.

@mitar
Copy link
Contributor Author

mitar commented Oct 3, 2018

In fact I am more interesting in hooking into underlying observe logic. Not so much how it is exposed (through proxy or other means). But probably it can be the same thing. Generally it is more or less something like "every time X gets invalidated, also call this extra code, and when Y gets rerun, call this as well".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants