-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Initial support of TC39 Observable subscriptions * tko.observable) Trigger immediately with current with TC39 `{next}`-style subscribe So when a TC39 style `subscribe` call is made, we trigger with the current value immediately, contrasting with the prior behaviour - namely triggering only on changes to the state. tc39/proposal-observable#190 * jsx) fix out-of-order observable insertion * jsx) Fix arrays of new nodes not having context applied * provider/native) Add a provider that has “pre-compiled” binding handler arguments This will be used by the JSX utility. * component/jsx) Support observables for Component jsx templates Now JSX binding arguments are known at the compile-time, so this ought to work: ```js get template () { return <div ko-text={this.someValue}></div> } ``` * jsx) Add support for bindings directly referenced in JSX Sample: ```html <component x={alpha}></component> ``` … will be given `params={x: alpha}` * provider/native) Fix failure when node doesn’t have `NATIVE_BINDINGS` * component/jsx) re-apply bindings to top-level templates * tko.bind) Fix regression with `onValueUpdate` not working @ctcarton * tko.observable/computed) Have TC39 subscriptions fire immediately for observable/computed * jsx) Fix insert of array appending instead of inserting
- Loading branch information
1 parent
5615bf6
commit 178e801
Showing
20 changed files
with
403 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
|
||
import { | ||
removeDisposeCallback, addDisposeCallback | ||
} from 'tko.utils' | ||
|
||
|
||
export default class Subscription { | ||
constructor (target, observer, disposeCallback) { | ||
this._target = target | ||
this._callback = observer.next | ||
this._disposeCallback = disposeCallback | ||
this._isDisposed = false | ||
this._domNodeDisposalCallback = null | ||
} | ||
|
||
dispose () { | ||
if (this._domNodeDisposalCallback) { | ||
removeDisposeCallback(this._node, this._domNodeDisposalCallback) | ||
} | ||
this._isDisposed = true | ||
this._disposeCallback() | ||
} | ||
|
||
disposeWhenNodeIsRemoved (node) { | ||
this._node = node | ||
addDisposeCallback(node, this._domNodeDisposalCallback = this.dispose.bind(this)) | ||
} | ||
|
||
// TC39 Observable API | ||
unsubscribe () { this.dispose() } | ||
get closed () { return this._isDisposed } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.