public async Task InitializeBridgeAsync() { await _bundleLoader.InitializeAsync().ConfigureAwait(false); using (Tracer.Trace(Tracer.TRACE_TAG_REACT_BRIDGE, "initializeBridge").Start()) { _bridge = await QueueConfiguration.JavaScriptQueueThread.CallOnQueue(() => { QueueConfiguration.JavaScriptQueueThread.AssertOnThread(); var jsExecutor = _jsExecutorFactory(); var bridge = default(ReactBridge); using (Tracer.Trace(Tracer.TRACE_TAG_REACT_BRIDGE, "ReactBridgeCtor").Start()) { bridge = new ReactBridge( jsExecutor, new NativeModulesReactCallback(this), QueueConfiguration.NativeModulesQueueThread); } using (Tracer.Trace(Tracer.TRACE_TAG_REACT_BRIDGE, "setBatchedBridgeConfig").Start()) { bridge.SetGlobalVariable("__fbBatchedBridgeConfig", BuildModulesConfig()); } _bundleLoader.LoadScript(bridge); return(bridge); }).ConfigureAwait(false); } }
public async Task InitializeBridgeAsync() { await _bundleLoader.InitializeAsync().ConfigureAwait(false); using (RNTracer.Trace(RNTracer.TRACE_TAG_REACT_BRIDGE, "initializeBridge").Start()) { _bridge = await QueueConfiguration.JavaScriptQueueThread.CallOnQueue(() => { QueueConfiguration.JavaScriptQueueThread.AssertOnThread(); var jsExecutor = _jsExecutorFactory(); var bridge = default(ReactBridge); using (RNTracer.Trace(RNTracer.TRACE_TAG_REACT_BRIDGE, "ReactBridgeCtor").Start()) { bridge = new ReactBridge( jsExecutor, new NativeModulesReactCallback(this), QueueConfiguration.NativeModulesQueueThread); } return(bridge); }).ConfigureAwait(false); await QueueConfiguration.JavaScriptQueueThread.CallOnQueue(() => { using (RNTracer.Trace(RNTracer.TRACE_TAG_REACT_BRIDGE, "setBatchedBridgeConfig").Start()) { string moduleConfig = null; bool firstTime = true; string configPath = Tizen.Applications.Application.Current.DirectoryInfo.Data + "moduleConfig.data"; firstTime = !File.Exists(configPath); if (firstTime) { RNTracer.Write(ReactConstants.Tag, "FirstTime output to configPath = " + configPath); moduleConfig = BuildModulesConfig(); File.WriteAllText(configPath, moduleConfig); } else { RNTracer.Write(ReactConstants.Tag, "Get config from configPath = " + configPath); moduleConfig = File.ReadAllText(configPath); } _bridge.SetGlobalVariable("__fbBatchedBridgeConfig", moduleConfig); //Console.WriteLine(">>>>>>> BatchedBridgeConfig: "+ BuildModulesConfig()); } /* TODO: Comment temporarily for skipping bundle js's laoding BOY.YANG 2017-02-18 */ /* use try...catch to capture the core info */ _bundleLoader.LoadScript(_bridge); return(default(object)); }).ConfigureAwait(false); } }