@@ -402,6 +402,20 @@ private JavaScriptValue EnsureParseFunction()
402
402
return _parseFunction ;
403
403
}
404
404
405
+ private JavaScriptValue EnsureBatchedBridge ( )
406
+ {
407
+ var globalObject = EnsureGlobalObject ( ) ;
408
+ var propertyId = JavaScriptPropertyId . FromString ( FBBatchedBridgeVariableName ) ;
409
+ var fbBatchedBridge = globalObject . GetProperty ( propertyId ) ;
410
+ if ( fbBatchedBridge . ValueType != JavaScriptValueType . Object )
411
+ {
412
+ throw new InvalidOperationException (
413
+ Invariant ( $ "Could not resolve '{ FBBatchedBridgeVariableName } ' object. Check the JavaScript bundle to ensure it is generated correctly.") ) ;
414
+ }
415
+
416
+ return fbBatchedBridge ;
417
+ }
418
+
405
419
private JavaScriptValue EnsureStringifyFunction ( )
406
420
{
407
421
if ( ! _stringifyFunction . IsValid )
@@ -418,9 +432,7 @@ private JavaScriptValue EnsureCallFunction()
418
432
{
419
433
if ( ! _callFunctionAndReturnFlushedQueueFunction . IsValid )
420
434
{
421
- var globalObject = EnsureGlobalObject ( ) ;
422
- var propertyId = JavaScriptPropertyId . FromString ( FBBatchedBridgeVariableName ) ;
423
- var fbBatchedBridge = globalObject . GetProperty ( propertyId ) ;
435
+ var fbBatchedBridge = EnsureBatchedBridge ( ) ;
424
436
var functionPropertyId = JavaScriptPropertyId . FromString ( "callFunctionReturnFlushedQueue" ) ;
425
437
_callFunctionAndReturnFlushedQueueFunction = fbBatchedBridge . GetProperty ( functionPropertyId ) ;
426
438
}
@@ -432,9 +444,7 @@ private JavaScriptValue EnsureInvokeFunction()
432
444
{
433
445
if ( ! _invokeCallbackAndReturnFlushedQueueFunction . IsValid )
434
446
{
435
- var globalObject = EnsureGlobalObject ( ) ;
436
- var propertyId = JavaScriptPropertyId . FromString ( FBBatchedBridgeVariableName ) ;
437
- var fbBatchedBridge = globalObject . GetProperty ( propertyId ) ;
447
+ var fbBatchedBridge = EnsureBatchedBridge ( ) ;
438
448
var functionPropertyId = JavaScriptPropertyId . FromString ( "invokeCallbackAndReturnFlushedQueue" ) ;
439
449
_invokeCallbackAndReturnFlushedQueueFunction = fbBatchedBridge . GetProperty ( functionPropertyId ) ;
440
450
}
@@ -446,9 +456,7 @@ private JavaScriptValue EnsureFlushedQueueFunction()
446
456
{
447
457
if ( ! _flushedQueueFunction . IsValid )
448
458
{
449
- var globalObject = EnsureGlobalObject ( ) ;
450
- var propertyId = JavaScriptPropertyId . FromString ( FBBatchedBridgeVariableName ) ;
451
- var fbBatchedBridge = globalObject . GetProperty ( propertyId ) ;
459
+ var fbBatchedBridge = EnsureBatchedBridge ( ) ;
452
460
var functionPropertyId = JavaScriptPropertyId . FromString ( "flushedQueue" ) ;
453
461
_flushedQueueFunction = fbBatchedBridge . GetProperty ( functionPropertyId ) ;
454
462
}
0 commit comments