This repository has been archived by the owner on Feb 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added transaction support for autorun method
- Loading branch information
Showing
4 changed files
with
43 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
mobX create observable, autorun and dispose x 39,205 ops/sec ±5.73% (71 runs sampled) | ||
mobX create observable, autorun and dispose x 40,866 ops/sec ±3.94% (75 runs sampled) | ||
|
||
proxevable create observable, autorun and dispose x 76,322 ops/sec ±5.73% (73 runs sampled) | ||
proxevable create observable, autorun and dispose x 75,569 ops/sec ±5.37% (72 runs sampled) | ||
|
||
Fastest is proxevable create observable, autorun and dispose | ||
|
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
File renamed without changes.
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,20 @@ | ||
import test from 'ava' | ||
import {observable, autorun, transaction} from '../index' | ||
|
||
test('transaction batches', t => { | ||
let c = 0 | ||
const a = observable({g: 0}) | ||
autorun(() => { | ||
const ident = (v) => v | ||
ident(a.g) | ||
c += 1 | ||
}) | ||
transaction(() => { | ||
a.g = 1 | ||
transaction(() => { | ||
a.g = 2 | ||
a.g = 3 | ||
}) | ||
}) | ||
t.truthy(c === 2) | ||
}) |