Skip to content

Instantly share code, notes, and snippets.

@thysultan
Last active August 27, 2017 01:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thysultan/2550f860fe38ff483bceb42af94134e7 to your computer and use it in GitHub Desktop.
Save thysultan/2550f860fe38ff483bceb42af94134e7 to your computer and use it in GitHub Desktop.
virtual node interface
interface Virtual {
merge(Virtual)
}
interface VirtualStyle extends Virtual {
merge(VirtualStyle)
}
interface VirtualProperties extends Virtual {
style: VirtualStyle
merge(VirtualProperties)
}
interface VirtualNode extends Virtual {
type: number // Fragment|Text|Element...
tag: string
properties: VirtualProperties
children: VirtualLinkedList
merge(VirtualNode)
}
interface VirtualLinkedList extends Virtual {
insert(VirtualNode, BeforeVirtualNode)
remove(VirtualNode)
push(VirtualNode)
unshift(VirtualNode)
pop()
shift()
merge(VirtualLinkedList)
}
Node.from = (VirtualNode): Node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment