@@ -5,24 +5,24 @@ import { flushSync } from '../runtime.js';
55import  {  raf  }  from  '../timing.js' ; 
66import  {  internal_set ,  mark_reactions ,  pending  }  from  './sources.js' ; 
77
8- /** @type  {Set<Fork > } */ 
9- const  forks  =  new  Set ( ) ; 
8+ /** @type  {Set<Batch > } */ 
9+ const  batches  =  new  Set ( ) ; 
1010
11- /** @type  {Fork  | null } */ 
12- export  let  active_fork  =  null ; 
11+ /** @type  {Batch  | null } */ 
12+ export  let  current_batch  =  null ; 
1313
14- export  function  remove_active_fork ( )  { 
15- 	active_fork  =  null ; 
14+ export  function  remove_current_batch ( )  { 
15+ 	current_batch  =  null ; 
1616} 
1717
1818/** Update `$effect.pending()` */ 
1919function  update_pending ( )  { 
20- 	// internal_set(pending, forks .size > 0); 
20+ 	// internal_set(pending, batches .size > 0); 
2121} 
2222
2323let  uid  =  1 ; 
2424
25- export  class  Fork  { 
25+ export  class  Batch  { 
2626	id  =  uid ++ ; 
2727
2828	/** @type  {Map<Source, any> } */ 
@@ -40,8 +40,8 @@ export class Fork {
4040	pending  =  0 ; 
4141
4242	apply ( )  { 
43- 		if  ( forks . size  ===  1 )  { 
44- 			// if this is the latest (and only) fork , we have nothing to do 
43+ 		if  ( batches . size  ===  1 )  { 
44+ 			// if this is the latest (and only) batch , we have nothing to do 
4545			return  noop ; 
4646		} 
4747
@@ -56,10 +56,10 @@ export class Fork {
5656			source . v  =  current ; 
5757		} 
5858
59- 		for  ( const  fork  of  forks )  { 
60- 			if  ( fork  ===  this )  continue ; 
59+ 		for  ( const  batch  of  batches )  { 
60+ 			if  ( batch  ===  this )  continue ; 
6161
62- 			for  ( const  [ source ,  previous ]  of  fork . previous )  { 
62+ 			for  ( const  [ source ,  previous ]  of  batch . previous )  { 
6363				if  ( ! current_values . has ( source ) )  { 
6464					// mark_reactions(source, DIRTY); 
6565					current_values . set ( source ,  source . v ) ; 
@@ -88,19 +88,19 @@ export class Fork {
8888	} 
8989
9090	remove ( )  { 
91- 		forks . delete ( this ) ; 
91+ 		batches . delete ( this ) ; 
9292
93- 		for  ( var  fork  of  forks )  { 
94- 			if  ( fork . id  <  this . id )  { 
95- 				// other fork  is older than this 
93+ 		for  ( var  batch  of  batches )  { 
94+ 			if  ( batch . id  <  this . id )  { 
95+ 				// other batch  is older than this 
9696				for  ( var  source  of  this . previous . keys ( ) )  { 
97- 					fork . previous . delete ( source ) ; 
97+ 					batch . previous . delete ( source ) ; 
9898				} 
9999			}  else  { 
100- 				// other fork  is newer than this 
101- 				for  ( var  source  of  fork . previous . keys ( ) )  { 
100+ 				// other batch  is newer than this 
101+ 				for  ( var  source  of  batch . previous . keys ( ) )  { 
102102					if  ( this . previous . has ( source ) )  { 
103- 						fork . previous . set ( source ,  source . v ) ; 
103+ 						batch . previous . set ( source ,  source . v ) ; 
104104					} 
105105				} 
106106			} 
@@ -113,7 +113,7 @@ export class Fork {
113113	 * @param  {() => void } fn 
114114	 */ 
115115	run ( fn )  { 
116- 		active_fork  =  this ; 
116+ 		current_batch  =  this ; 
117117		fn ( ) ; 
118118	} 
119119
@@ -143,15 +143,15 @@ export class Fork {
143143	} 
144144
145145	static  ensure ( )  { 
146- 		if  ( active_fork  ===  null )  { 
147- 			if  ( forks . size  ===  0 )  { 
146+ 		if  ( current_batch  ===  null )  { 
147+ 			if  ( batches . size  ===  0 )  { 
148148				raf . tick ( update_pending ) ; 
149149			} 
150150
151- 			active_fork  =  new  Fork ( ) ; 
152- 			forks . add ( active_fork ) ; 
151+ 			current_batch  =  new  Batch ( ) ; 
152+ 			batches . add ( current_batch ) ; 
153153		} 
154154
155- 		return  active_fork ; 
155+ 		return  current_batch ; 
156156	} 
157157} 
0 commit comments