protected override void BuildRenderTree(RenderTreeBuilder builder) { //This component must be rendered once! //Even if the javascript script is not re-renderer if the component is called twice, it should be already available in the DOM if (_isInitialized) { return; } builder.OpenElement(0, "script"); builder.AddAttribute(1, "type", "text/javascript"); builder.AddMarkupContent(1, ContextBridgeHelper.GetBlazorXamarinJavascript() + ContextBridgeHelper.GetContextBridgeJavascript().Replace("%_contextBridgeURI%", BlazorMobileService.GetContextBridgeURI())); builder.CloseElement(); _isInitialized = true; }
protected override void BuildRenderTree(RenderTreeBuilder builder) { //This component must be rendered once! //If the component is disposed and then re-rendered, then something is wrong with the current project configuration if (_isInitialized) { return; } builder.OpenElement(0, "script"); builder.AddAttribute(1, "type", "text/javascript"); builder.AddContent(1, ContextBridgeHelper.GetBlazorXamarinJavascript() + ContextBridgeHelper.GetContextBridgeJavascript().Replace("%_contextBridgeURI%", BlazorMobileService.GetContextBridgeURI())); builder.CloseElement(); _isInitialized = true; }