File tree Expand file tree Collapse file tree 5 files changed +36
-0
lines changed
react-native-renderer/src Expand file tree Collapse file tree 5 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -329,6 +329,8 @@ export function getChildHostContext() {
329
329
330
330
export const scheduleTimeout = setTimeout ;
331
331
export const cancelTimeout = clearTimeout ;
332
+ // TODO: Implement for ART.
333
+ export const queueMicrotask = undefined ;
332
334
export const noTimeout = - 1 ;
333
335
334
336
export function shouldSetTextContent ( type , props ) {
Original file line number Diff line number Diff line change @@ -384,6 +384,21 @@ export const scheduleTimeout: any =
384
384
export const cancelTimeout : any =
385
385
typeof clearTimeout === 'function' ? clearTimeout : ( undefined : any ) ;
386
386
export const noTimeout = - 1 ;
387
+ export const queueMicrotask : ( Function => void ) | undefined =
388
+ typeof queueMicrotask === 'function'
389
+ ? queueMicrotask
390
+ : typeof Promise !== 'undefined'
391
+ ? callback =>
392
+ Promise . resolve ( null )
393
+ . then ( callback )
394
+ . catch ( handleErrorInNextTick )
395
+ : scheduleTimeout ;
396
+
397
+ function handleErrorInNextTick ( error ) {
398
+ setTimeout ( ( ) => {
399
+ throw error ;
400
+ } ) ;
401
+ }
387
402
388
403
// -------------------
389
404
// Mutation
Original file line number Diff line number Diff line change @@ -347,6 +347,8 @@ export const warnsIfNotActing = false;
347
347
348
348
export const scheduleTimeout = setTimeout ;
349
349
export const cancelTimeout = clearTimeout ;
350
+ // TODO: implement for React Native.
351
+ export const queueMicrotask = undefined ;
350
352
export const noTimeout = - 1 ;
351
353
352
354
// -------------------
Original file line number Diff line number Diff line change @@ -246,6 +246,8 @@ export const warnsIfNotActing = true;
246
246
247
247
export const scheduleTimeout = setTimeout ;
248
248
export const cancelTimeout = clearTimeout ;
249
+ // TODO: Implement for React Native.
250
+ export const queueMicrotask = undefined ;
249
251
export const noTimeout = - 1 ;
250
252
251
253
export function shouldSetTextContent ( type : string , props : Props ) : boolean {
Original file line number Diff line number Diff line change @@ -220,6 +220,21 @@ export const warnsIfNotActing = true;
220
220
221
221
export const scheduleTimeout = setTimeout ;
222
222
export const cancelTimeout = clearTimeout ;
223
+ export const queueMicrotask =
224
+ typeof queueMicrotask === 'function'
225
+ ? queueMicrotask
226
+ : typeof Promise !== 'undefined'
227
+ ? callback =>
228
+ Promise . resolve ( null )
229
+ . then ( callback )
230
+ . catch ( handleErrorInNextTick )
231
+ : scheduleTimeout ;
232
+
233
+ function handleErrorInNextTick ( error ) {
234
+ setTimeout ( ( ) => {
235
+ throw error ;
236
+ } ) ;
237
+ }
223
238
export const noTimeout = - 1 ;
224
239
225
240
// -------------------
You can’t perform that action at this time.
0 commit comments