Can I wrap an observable returned from mobx? #2882
Unanswered
burtonator
asked this question in
General
Replies: 3 comments
-
Wrapping is a pretty vague term, I'm not sure what you mean by it. But,
just try it first in a small experiment?
…On Fri, 9 Apr 2021, 02:39 Kevin Burton, ***@***.***> wrote:
I have an observable I'm using in an observer. however, I want to wrap it
so that I can override some of the behavior as I'm building an undo/redo
store.
Will the observer work with the observable even though it's wrapped now?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2882>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBEE4V3FN2IIX2XXUPTTHZLETANCNFSM42UAS6VA>
.
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Let's say I have an observable with an @computed method... so it's has a getMessage() and a setMessage method I then create a wrapped version that has an internal instance variable of the original that I delegate methods to. so somethign like
class FooInstance {
constructor(private readonly delegate: MainInstance);
public setMessage(message: string) {
this.delegate.setMessage(message);
}
public getMessage() {
return this.delegate.getMessage();
}
} ... something like that. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yeah no problem, MobX will track through that.
…On Fri, Apr 9, 2021 at 4:37 PM Kevin Burton ***@***.***> wrote:
Let's say I have an observable with an @computed
<https://github.com/computed> method...
so it's has a getMessage() and a setMessage method
I then create a wrapped version that has an internal instance variable of
the original that I delegate methods to.
so somethign like
class FooInstance {
constructor(private readonly delegate: MainInstance);
public setMessage(message: string) {
this.delegate.setMessage(message);
}
public getMessage() {
return this.delegate.getMessage();
}
}
... something like that.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2882 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAN4NBC7A2Q3BYMLG5CBKYDTH4NLLANCNFSM42UAS6VA>
.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have an observable I'm using in an observer. however, I want to wrap it so that I can override some of the behavior as I'm building an undo/redo store.
Will the observer work with the observable even though it's wrapped now?
Beta Was this translation helpful? Give feedback.
All reactions