-
Notifications
You must be signed in to change notification settings - Fork 12
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
Add support for async initialisation (similar to option type) #84
Conversation
@@ -90,4 +90,148 @@ describe('rxjs/rxjs', () => { | |||
expect(complete).to.be.false; | |||
}); | |||
}); | |||
|
|||
describe('fromObservable', () => { | |||
it('should be unresolved when not connected and no fallback is given', () => { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
expect(d$.resolved).to.be.false; | ||
}); | ||
|
||
it('should subscribe on observable when used to power a reactor', () => { |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
src/derivable/apply-mixins.ts
Outdated
declare module './base-derivable' { | ||
export interface BaseDerivable<V> { | ||
get(): V; | ||
getOr<T>(t: T): V; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
abstract derive: Derivable<V>['derive']; | ||
abstract pluck: Derivable<V>['pluck']; | ||
connected = false; | ||
_connected$?: SettableDerivable<boolean> = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In following 'documentation' PR, we need to explain this and its relation to the connected$
getter.
if (state !== unresolved) { | ||
return state; | ||
} | ||
if (derivationStackDepth > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smart. :-)
Closes #58, but built into the main Sherlock library. It turned out that a separate sherlock-async library has more downsides than upsides. The implementation is much simpler this way while having very limited overhead.
Note, this is effectively a rewrite of the derivables (reactors and dependency tracking are mostly untouched).
Docs are tracked in separate issues #86 and #87.