This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Fiber tags | |
const HOST_COMPONENT = "host"; | |
const CLASS_COMPONENT = "class"; | |
const HOST_ROOT = "root"; | |
// Global state | |
const updateQueue = []; | |
let nextUnitOfWork = null; | |
let pendingCommit = null; | |
function render(elements, containerDom) { | |
updateQueue.push({ | |
from: HOST_ROOT, | |
dom: containerDom, | |
newProps: { children: elements } | |
}); | |
requestIdleCallback(performWork); | |
} | |
function scheduleUpdate(instance, partialState) { | |
updateQueue.push({ | |
from: CLASS_COMPONENT, | |
instance: instance, | |
partialState: partialState | |
}); | |
requestIdleCallback(performWork); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment