Comparing version 0.0.9 to 0.0.10
@@ -313,5 +313,5 @@ "use strict"; | ||
function findReplacementCandidateForDOMElement(forgoElement, nodes, searchNodesFrom) { | ||
if (forgoElement.key) { | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i]; | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i]; | ||
if (forgoElement.key) { | ||
const stateOnNode = getForgoState(node); | ||
@@ -322,7 +322,3 @@ if ((stateOnNode === null || stateOnNode === void 0 ? void 0 : stateOnNode.key) === forgoElement.key) { | ||
} | ||
return { found: false }; | ||
} | ||
else { | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i]; | ||
else { | ||
if (node.nodeType === ELEMENT_NODE_TYPE) { | ||
@@ -335,4 +331,4 @@ const element = node; | ||
} | ||
return { found: false }; | ||
} | ||
return { found: false }; | ||
} | ||
@@ -346,7 +342,7 @@ /* | ||
function findReplacementCandidateForCustomComponent(forgoElement, nodes, searchNodesFrom) { | ||
if (forgoElement.key) { | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i]; | ||
const stateOnNode = getForgoState(node); | ||
if (stateOnNode && stateOnNode.components.length > 0) { | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i]; | ||
const stateOnNode = getForgoState(node); | ||
if (stateOnNode && stateOnNode.components.length > 0) { | ||
if (forgoElement.key) { | ||
if (stateOnNode.components[0].key === forgoElement.key) { | ||
@@ -356,10 +352,3 @@ return { found: true, index: i }; | ||
} | ||
} | ||
return { found: false }; | ||
} | ||
else { | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i]; | ||
const stateOnNode = getForgoState(node); | ||
if (stateOnNode && stateOnNode.components.length > 0) { | ||
else { | ||
if (stateOnNode.components[0].ctor === forgoElement.type) { | ||
@@ -370,4 +359,4 @@ return { found: true, index: i }; | ||
} | ||
return { found: false }; | ||
} | ||
return { found: false }; | ||
} | ||
@@ -374,0 +363,0 @@ /* |
{ | ||
"name": "forgo", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"main": "./dist", | ||
@@ -16,2 +16,3 @@ "devDependencies": { | ||
"scripts": { | ||
"build": "tsc", | ||
"build-test": "(cd test && ./build.sh)", | ||
@@ -18,0 +19,0 @@ "test": "mocha -r esm test/dist/test.js" |
@@ -134,3 +134,3 @@ # forgo | ||
The most straight forward way to do rerender is by invoking it with `args.element` as follows. | ||
The most straight forward way to do rerender is by invoking it with `args.element` as the only argument - as follows. | ||
@@ -166,2 +166,9 @@ ```tsx | ||
## Try it out on CodeSandbox | ||
You can try the [Todo List app with Forgo](https://codesandbox.io/s/forgo-todos-javascript-1oi9b) on CodeSandbox. | ||
Or if you prefer Typescript, try [Forgo TodoList in TypeScript](https://codesandbox.io/s/forgo-todos-typescript-9v0iy). | ||
## Recap with a complete example | ||
@@ -168,0 +175,0 @@ |
@@ -533,5 +533,5 @@ /* | ||
): CandidateSearchResult { | ||
if (forgoElement.key) { | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i] as ChildNode; | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i] as ChildNode; | ||
if (forgoElement.key) { | ||
const stateOnNode = getForgoState(node); | ||
@@ -541,7 +541,3 @@ if (stateOnNode?.key === forgoElement.key) { | ||
} | ||
} | ||
return { found: false }; | ||
} else { | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i] as ChildNode; | ||
} else { | ||
if (node.nodeType === ELEMENT_NODE_TYPE) { | ||
@@ -554,4 +550,4 @@ const element = node as HTMLElement; | ||
} | ||
return { found: false }; | ||
} | ||
return { found: false }; | ||
} | ||
@@ -570,18 +566,11 @@ | ||
): CandidateSearchResult { | ||
if (forgoElement.key) { | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i] as ChildNode; | ||
const stateOnNode = getForgoState(node); | ||
if (stateOnNode && stateOnNode.components.length > 0) { | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i] as ChildNode; | ||
const stateOnNode = getForgoState(node); | ||
if (stateOnNode && stateOnNode.components.length > 0) { | ||
if (forgoElement.key) { | ||
if (stateOnNode.components[0].key === forgoElement.key) { | ||
return { found: true, index: i }; | ||
} | ||
} | ||
} | ||
return { found: false }; | ||
} else { | ||
for (let i = searchNodesFrom; i < nodes.length; i++) { | ||
const node = nodes[i] as ChildNode; | ||
const stateOnNode = getForgoState(node); | ||
if (stateOnNode && stateOnNode.components.length > 0) { | ||
} else { | ||
if (stateOnNode.components[0].ctor === forgoElement.type) { | ||
@@ -592,4 +581,4 @@ return { found: true, index: i }; | ||
} | ||
return { found: false }; | ||
} | ||
return { found: false }; | ||
} | ||
@@ -596,0 +585,0 @@ |
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
311
70526
1172