Skip to content

Latest commit

 

History

History
34 lines (31 loc) · 1.13 KB

driver-spec.md

File metadata and controls

34 lines (31 loc) · 1.13 KB

Driver Spec

Driver is the key concept that make the application cross-container running. Rax have been implemented browser driver, server driver and weex driver. If want Rax works on other container, only need implement the driver specification. The driver should implement follow method:

  • getElementById(id)
  • getChildNodes(node)
  • createBody()
  • createFragment()
  • createComment(content)
  • createText(text)
  • updateText(node, text)
  • createElement(component: {type, props})
  • appendChild(node, parent)
  • removeChild(node, parent)
  • replaceChild(newChild, oldChild, parent)
  • insertAfter(node, after, parent)
  • insertBefore(node, before, parent)
  • addEventListener(node, eventName, eventHandler)
  • removeEventListener(node, eventName, eventHandler)
  • removeAllEventListeners(node)
  • removeAttribute(node, propKey)
  • setAttribute(node, propKey, propValue)
  • setStyles(node, styles)
  • getWindowWidth()
  • beforeRender()
  • afterRender()
const container = driver.createBody();
render(element, container, driver);