@@ -27,10 +27,10 @@ import {
2727 set_hydrate_node
2828} from '../hydration.js' ;
2929import { get_next_sibling } from '../operations.js' ;
30- import { queue_before_micro_task } from '../task.js' ;
30+ import { queue_boundary_micro_task } from '../task.js' ;
3131
32- const SUSPEND_INCREMENT = Symbol ( ) ;
33- const SUSPEND_DECREMENT = Symbol ( ) ;
32+ const ASYNC_INCREMENT = Symbol ( ) ;
33+ const ASYNC_DECREMENT = Symbol ( ) ;
3434
3535/**
3636 * @param {Effect } boundary
@@ -70,10 +70,10 @@ export function boundary(node, props, boundary_fn) {
7070 /** @type {Effect } */
7171 var boundary_effect ;
7272 /** @type {Effect | null } */
73- var suspended_effect = null ;
73+ var async_effect = null ;
7474 /** @type {DocumentFragment | null } */
75- var suspended_fragment = null ;
76- var suspend_count = 0 ;
75+ var async_fragment = null ;
76+ var async_count = 0 ;
7777
7878 block ( ( ) => {
7979 var boundary = /** @type {Effect } */ ( active_effect ) ;
@@ -101,35 +101,35 @@ export function boundary(node, props, boundary_fn) {
101101 boundary . fn = ( /** @type {unknown } */ input ) => {
102102 let pending = props . pending ;
103103
104- if ( input === SUSPEND_INCREMENT ) {
104+ if ( input === ASYNC_INCREMENT ) {
105105 if ( ! pending ) {
106106 return false ;
107107 }
108108
109- if ( suspend_count ++ === 0 ) {
110- queue_before_micro_task ( ( ) => {
111- if ( suspended_effect ) {
109+ if ( async_count ++ === 0 ) {
110+ queue_boundary_micro_task ( ( ) => {
111+ if ( async_effect ) {
112112 return ;
113113 }
114114
115115 var effect = boundary_effect ;
116- suspended_effect = boundary_effect ;
116+ async_effect = boundary_effect ;
117117
118118 pause_effect (
119- suspended_effect ,
119+ async_effect ,
120120 ( ) => {
121121 /** @type {TemplateNode | null } */
122122 var node = effect . nodes_start ;
123123 var end = effect . nodes_end ;
124- suspended_fragment = document . createDocumentFragment ( ) ;
124+ async_fragment = document . createDocumentFragment ( ) ;
125125
126126 while ( node !== null ) {
127127 /** @type {TemplateNode | null } */
128128 var sibling =
129129 node === end ? null : /** @type {TemplateNode } */ ( get_next_sibling ( node ) ) ;
130130
131131 node . remove ( ) ;
132- suspended_fragment . append ( node ) ;
132+ async_fragment . append ( node ) ;
133133 node = sibling ;
134134 }
135135 } ,
@@ -145,22 +145,22 @@ export function boundary(node, props, boundary_fn) {
145145 return true ;
146146 }
147147
148- if ( input === SUSPEND_DECREMENT ) {
148+ if ( input === ASYNC_DECREMENT ) {
149149 if ( ! pending ) {
150150 return false ;
151151 }
152152
153- if ( -- suspend_count === 0 ) {
154- queue_before_micro_task ( ( ) => {
155- if ( ! suspended_effect ) {
153+ if ( -- async_count === 0 ) {
154+ queue_boundary_micro_task ( ( ) => {
155+ if ( ! async_effect ) {
156156 return ;
157157 }
158158 if ( boundary_effect ) {
159159 destroy_effect ( boundary_effect ) ;
160160 }
161- boundary_effect = suspended_effect ;
162- suspended_effect = null ;
163- anchor . before ( /** @type {DocumentFragment } */ ( suspended_fragment ) ) ;
161+ boundary_effect = async_effect ;
162+ async_effect = null ;
163+ anchor . before ( /** @type {DocumentFragment } */ ( async_fragment ) ) ;
164164 resume_effect ( boundary_effect ) ;
165165 } ) ;
166166 }
@@ -199,7 +199,7 @@ export function boundary(node, props, boundary_fn) {
199199 }
200200
201201 if ( failed ) {
202- queue_before_micro_task ( ( ) => {
202+ queue_boundary_micro_task ( ( ) => {
203203 render_snippet ( ( ) => {
204204 failed (
205205 anchor ,
@@ -226,9 +226,9 @@ export function boundary(node, props, boundary_fn) {
226226
227227/**
228228 * @param {Effect | null } effect
229- * @param {typeof SUSPEND_INCREMENT | typeof SUSPEND_DECREMENT } trigger
229+ * @param {typeof ASYNC_INCREMENT | typeof ASYNC_DECREMENT } trigger
230230 */
231- function trigger_suspense ( effect , trigger ) {
231+ export function trigger_async_boundary ( effect , trigger ) {
232232 var current = effect ;
233233
234234 while ( current !== null ) {
@@ -241,17 +241,3 @@ function trigger_suspense(effect, trigger) {
241241 current = current . parent ;
242242 }
243243}
244-
245- export function create_suspense ( ) {
246- var current = active_effect ;
247-
248- const suspend = ( ) => {
249- trigger_suspense ( current , SUSPEND_INCREMENT ) ;
250- } ;
251-
252- const unsuspend = ( ) => {
253- trigger_suspense ( current , SUSPEND_DECREMENT ) ;
254- } ;
255-
256- return [ suspend , unsuspend ] ;
257- }
0 commit comments