File tree Expand file tree Collapse file tree 5 files changed +39
-0
lines changed
react-native-renderer/src Expand file tree Collapse file tree 5 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -330,6 +330,9 @@ export function getChildHostContext() {
330
330
export const scheduleTimeout = setTimeout ;
331
331
export const cancelTimeout = clearTimeout ;
332
332
export const noTimeout = - 1 ;
333
+ export function queueMicrotask ( ) {
334
+ invariant ( false , 'Not implemented.' ) ;
335
+ }
333
336
334
337
export function shouldSetTextContent ( type , props ) {
335
338
return (
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 @@ -348,6 +348,9 @@ export const warnsIfNotActing = false;
348
348
export const scheduleTimeout = setTimeout ;
349
349
export const cancelTimeout = clearTimeout ;
350
350
export const noTimeout = - 1 ;
351
+ export function queueMicrotask ( ) {
352
+ invariant ( false , 'Not implemented.' ) ;
353
+ }
351
354
352
355
// -------------------
353
356
// Persistence
Original file line number Diff line number Diff line change @@ -247,6 +247,9 @@ export const warnsIfNotActing = true;
247
247
export const scheduleTimeout = setTimeout ;
248
248
export const cancelTimeout = clearTimeout ;
249
249
export const noTimeout = - 1 ;
250
+ export function queueMicrotask ( ) {
251
+ invariant ( false , 'Not implemented.' ) ;
252
+ }
250
253
251
254
export function shouldSetTextContent ( type : string , props : Props ) : boolean {
252
255
// TODO (bvaughn) Revisit this decision.
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