MCPcopy Create free account
hub / github.com/cyclejs/cyclejs / update

Method update

dom/src/IsolateModule.ts:99–120  ·  view source on GitHub ↗
(oldVNode: VNode, vNode: VNode)

Source from the content-addressed store, hash-verified

97 },
98
99 update(oldVNode: VNode, vNode: VNode) {
100 const {data: oldData = {}} = oldVNode;
101 const {elm, data = {}} = vNode;
102 const oldFullScope: string = (oldData as any).isolate || '';
103 const fullScope: string = (data as any).isolate || '';
104
105 // Same element, but different scope, so update the data structures
106 if (fullScope && fullScope !== oldFullScope) {
107 if (oldFullScope) { self.elementsByFullScope.delete(oldFullScope); }
108 self.elementsByFullScope.set(fullScope, elm as Element);
109 const delegators = self.delegatorsByFullScope.get(oldFullScope);
110 if (delegators) {
111 self.delegatorsByFullScope.delete(oldFullScope);
112 self.delegatorsByFullScope.set(fullScope, delegators);
113 }
114 }
115 // Same element, but lost the scope, so update the data structures
116 if (oldFullScope && !fullScope) {
117 self.elementsByFullScope.delete(oldFullScope);
118 self.delegatorsByFullScope.delete(oldFullScope);
119 }
120 },
121
122 destroy(vNode: VNode) {
123 self.cleanupVNode(vNode);

Callers 2

updateChartFunction · 0.80
reducersFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected