diff --git a/src/Lit/Hook.fs b/src/Lit/Hook.fs index a84ceb8..a27a0d6 100644 --- a/src/Lit/Hook.fs +++ b/src/Lit/Hook.fs @@ -14,7 +14,7 @@ module internal HookUtil = let [] HMR_CLASS_EXPR = """class extends $0 { constructor() { super($3...) } - get name() { return $2; } + get __name() { return $2; } get renderFn() { return $1.value; } set renderFn(v) { $1.value = v; @@ -332,7 +332,7 @@ type HookDirective() = #endif abstract renderFn: JS.Function with get, set - abstract name: string + abstract __name: string member this.requestUpdate() = this.setValue(_hooks.render()) @@ -368,7 +368,7 @@ type HookDirective() = token.Subscribe(fun info -> _hooks.remove_css() let updatedModule = info.NewModule - this.renderFn <- updatedModule?(this.name)?renderFn + this.renderFn <- updatedModule?(this.__name)?renderFn ) |> Some #endif diff --git a/src/Lit/LitElement.fs b/src/Lit/LitElement.fs index e0bbc3d..da6cbf1 100644 --- a/src/Lit/LitElement.fs +++ b/src/Lit/LitElement.fs @@ -185,7 +185,7 @@ type LitHookElement<'Props>(initProps: obj -> unit) = do initProps(jsThis) abstract renderFn: JS.Function with get, set - abstract name: string + abstract __name: string member _.render() = _hooks.render() @@ -211,7 +211,7 @@ type LitHookElement<'Props>(initProps: obj -> unit) = token.Subscribe(fun info -> _hooks.remove_css() let updatedModule = info.NewModule - let updatedExport = updatedModule?(this.name) + let updatedExport = updatedModule?(this.__name) this.renderFn <- updatedExport?renderFn updateStyleSheets info.Data this (updatedExport?styles) ) @@ -244,7 +244,7 @@ type LitElementAttribute(name: string) = failInit() config.InitPromise - |> Promise.iter (fun _ -> + |> Promise.map (fun _ -> let config = config :> LitConfig let styles = @@ -316,6 +316,10 @@ type LitElementAttribute(name: string) = styles |> Option.iter (fun styles -> dummyFn?styles <- styles) #endif ) + |> Promise.catchEnd (fun er -> + console.error(er) + ) + box dummyFn :?> _ []