MCPcopy Index your code
hub / github.com/witheve/Eve / updateViews

Method updateViews

src/ide.ts:2826–2858  ·  view source on GitHub ↗
(inserts: string[], removes: string[], records)

Source from the content-addressed store, hash-verified

2824 activeViews:any = {};
2825
2826 updateViews(inserts: string[], removes: string[], records) {
2827 for(let recordId of removes) {
2828 let view = this.activeViews[recordId];
2829 if(!view) continue;
2830 // Detach view
2831 if(view.widget) view.widget.clear();
2832 view.widget = undefined;
2833 }
2834
2835 for(let recordId of inserts) {
2836 // if the view already has a parent, leave it be.
2837 if(indexes.byChild.index[recordId]) continue;
2838
2839 // If the view is already active, he doesn't need inserted again.
2840 if(this.activeViews[recordId] && this.activeViews[recordId].widget) continue;
2841
2842 // Otherwise, we'll grab it and attach it to its creator in the editor.
2843 let record = records[recordId];
2844 let view = this.activeViews[recordId] = this.activeViews[recordId] || {record: recordId, container: document.createElement("div")};
2845 view.container.className = "view-container";
2846
2847 //this.attachView(recordId, record.node)
2848 // Find the source node for this view.
2849 if(record.span) {
2850 this.attachView(recordId, record.span[0]);
2851 } else if(record.node) {
2852 client.send({type: "findNode", recordId, node: record.node[0]});
2853 } else {
2854 console.warn("Unable to parent view that doesn't provide its origin node or span id", record);
2855 }
2856
2857 }
2858 }
2859
2860 attachView(recordId:string, spanId:string) {
2861 let view = this.activeViews[recordId];

Callers 1

client.tsFile · 0.80

Calls 3

attachViewMethod · 0.95
clearMethod · 0.65
sendMethod · 0.65

Tested by

no test coverage detected