SHARE
TWEET

Untitled

a guest Aug 25th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function reconcile(parentDom, instance, element) {
  2.    /** code... */
  3.   else if (instance.element.type === element.type) {
  4.     // perform props update here
  5.     updateDomProperties(instance.dom, instance.element.props, element.props);
  6.     instance.childInstances = reconcileChildren(instance, element);
  7.     instance.element = element;
  8.     return instance;
  9.   }
  10.      /** code... */
  11. }
  12.  
  13. function instantiate(element) {
  14.   const { type, props } = element;
  15.  
  16.   /** code... */
  17.   const dom = isTextElement
  18.     ? document.createTextNode("")
  19.     : document.createElement(type);
  20.    // apply new props and provide empty object as a prevObject since this is instanciation
  21.   updateDomProperties(dom, {}, props);
  22.    /** code... */
  23.  
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top