File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import * as mobx from 'mobx'
99import * as valtio from 'valtio'
1010import * as svelteStore from 'svelte/store'
1111import * as jotai from 'jotai'
12+ import * as reatom from '@reatom/core'
1213import * as agera from '../agera/dist/index.js' // 'agera'
1314
1415const bench = new Bench ( {
@@ -172,6 +173,32 @@ bench
172173 unsub ( )
173174 assert . equal ( logs . length , 3 )
174175 } )
176+ . add ( '@reatom/core / effect' , ( ) => {
177+ const a = reatom . atom ( 0 )
178+ const logs = [ ]
179+ const unsub = reatom . effect ( ( ) => {
180+ logs . push ( a ( ) )
181+ } )
182+
183+ a . set ( a ( ) + 1 )
184+ a . set ( a ( ) + 1 )
185+
186+ unsub ( )
187+ assert . equal ( logs . length , 2 )
188+ } )
189+ . add ( '@reatom/core / effect (update fn)' , ( ) => {
190+ const a = reatom . atom ( 0 )
191+ const logs = [ ]
192+ const unsub = reatom . effect ( ( ) => {
193+ logs . push ( a ( ) )
194+ } )
195+
196+ a . set ( v => v + 1 )
197+ a . set ( v => v + 1 )
198+
199+ unsub ( )
200+ assert . equal ( logs . length , 2 )
201+ } )
175202
176203await bench . run ( )
177204
Original file line number Diff line number Diff line change 2323 "node" : " >=16"
2424 },
2525 "dependencies" : {
26+ "@reatom/core" : " ^1000.15.1" ,
2627 "alien-signals-1" : " npm:alien-signals@1.0.4" ,
2728 "alien-signals-3" : " npm:alien-signals@3.1.2" ,
2829 "effector" : " ^23.4.4" ,
You can’t perform that action at this time.
0 commit comments