Comparing version 0.0.25 to 0.0.26
@@ -52,3 +52,3 @@ export declare type ForgoRef<T> = { | ||
export declare function setCustomEnv(value: any): void; | ||
export declare function mount(forgoNode: ForgoNode, parentElement: HTMLElement | null): void; | ||
export declare function mount(forgoNode: ForgoNode, container: HTMLElement | string | null): void; | ||
export declare function render(forgoNode: ForgoNode): { | ||
@@ -55,0 +55,0 @@ node: ChildNode; |
@@ -17,2 +17,3 @@ "use strict"; | ||
}; | ||
const isString = (val) => typeof val === 'string'; | ||
function setCustomEnv(value) { | ||
@@ -477,3 +478,4 @@ env = value; | ||
*/ | ||
function mount(forgoNode, parentElement) { | ||
function mount(forgoNode, container) { | ||
let parentElement = isString(container) ? env.document.querySelector(container) : container; | ||
if (parentElement) { | ||
@@ -480,0 +482,0 @@ const { node } = internalRender(forgoNode, undefined, [], true); |
{ | ||
"name": "forgo", | ||
"version": "0.0.25", | ||
"version": "0.0.26", | ||
"main": "./dist", | ||
@@ -5,0 +5,0 @@ "author": "Jeswin Kumar<jeswinpk@agilehead.com>", |
@@ -63,2 +63,10 @@ # forgo | ||
You could also pass a selector instead of an element. | ||
```js | ||
window.addEventListener("load", () => { | ||
mount(<SimpleTimer />, "#root"); | ||
}); | ||
``` | ||
## Child Components and Passing Props | ||
@@ -65,0 +73,0 @@ |
@@ -141,2 +141,4 @@ /* | ||
const isString = (val: unknown): val is string => typeof val === 'string' | ||
export function setCustomEnv(value: any) { | ||
@@ -830,3 +832,5 @@ env = value; | ||
*/ | ||
export function mount(forgoNode: ForgoNode, parentElement: HTMLElement | null) { | ||
export function mount(forgoNode: ForgoNode, container: HTMLElement | string | null) { | ||
let parentElement = isString(container) ? env.document.querySelector(container) : container; | ||
if (parentElement) { | ||
@@ -833,0 +837,0 @@ const { node } = internalRender(forgoNode, undefined, [], true); |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
85753
1484
334