Skip to content

Commit

Permalink
syncWatch + splitArrayChanges + prepare 1.4.0-beta2
Browse files Browse the repository at this point in the history
Introduce "synchWatch: true" option to use synchronous watch for new objects.
Added "splitArrayChanges: false" to receive a single notification for arrayChanges instead of item per item notifications.
Removed bower from the devDependencies so to remove warnings about bower being deprecated.
Add npm lock file for build stability.
Progress for comments in  0926751
  • Loading branch information
bago committed Feb 8, 2018
1 parent 0926751 commit 85a6925
Show file tree
Hide file tree
Showing 6 changed files with 2,127 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.DS_Store
node_modules
bower_components
.grunt
_SpecRunner.html
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,16 @@ The ```watch``` function returns an object with a "dispose" method you can call
Once disposed your model will be "unwatched"<br/>
<b>Synchronous tracking:</b> (since 1.4.0)<br/>
By default when new objects are added to the tree, they are automatically "watched" asynchronously (e.g: in a setTimeout) in order to keep the system more responsive.
Sometimes this behaviour is not "expected", so you can use the ```synchWatch: true``` option to force watch to happen "inline".
<b>Single notification for multiple array changes vs change by change notifications</b> (since 1.4.0)<br/>
By default when items are moved in an array you receive 2 different notifications, the first will report the "deleted item" and the second one will report the "added item".
If you prefer to receive an array of items in a single notification you can use the ```splitArrayChanges: false``` option. In that case you will receive an array of item instead of a single item even when there is only one item changed.
<b>Projects using KO-Reactor:</b><br/>
As of now I'm only aware of this excellent undo manager by Stefano Bagnara:
Expand All @@ -162,7 +172,7 @@ Do feel free to let me know if you have anything related to share and I'll gladl
<b>Further Notes:</b><br/>
Unlike ```ko.computed``` no listeners are created for subcribables within the evaluator function.
So we no longer have to concerned about creating unintended triggers as the code gets more complex.
So we no longer have to be concerned about creating unintended triggers as the code gets more complex.
Yet another usage not mentioned above example involves calling ```watch``` on a function as shown below:
Expand Down
Loading

0 comments on commit 85a6925

Please sign in to comment.