MCPcopy Create free account
hub / github.com/codag-megalith/codag-visualizer / init

Method init

frontend/src/webview-client/tutorial.ts:81–111  ·  view source on GitHub ↗

* Initialize and show tutorial if needed

()

Source from the content-addressed store, hash-verified

79 * Initialize and show tutorial if needed
80 */
81 init(): void {
82 this.overlay = document.getElementById('tutorialOverlay');
83 this.content = document.getElementById('tutorialContent');
84 this.dots = document.getElementById('tutorialDots');
85 this.prevBtn = document.getElementById('tutorialPrev');
86 this.nextBtn = document.getElementById('tutorialNext');
87 this.skipBtn = document.getElementById('tutorialSkip');
88
89 if (!this.overlay || !this.content || !this.dots || !this.prevBtn || !this.nextBtn || !this.skipBtn) {
90 return;
91 }
92
93 // Set up event listeners
94 this.prevBtn.addEventListener('click', () => this.prev());
95 this.nextBtn.addEventListener('click', () => this.next());
96 this.skipBtn.addEventListener('click', () => this.complete());
97
98 // Close on overlay click
99 this.overlay.addEventListener('click', (e) => {
100 if (e.target === this.overlay) {
101 this.complete();
102 }
103 });
104
105 // Close on Escape
106 document.addEventListener('keydown', (e) => {
107 if (e.key === 'Escape' && this.overlay?.style.display !== 'none') {
108 this.complete();
109 }
110 });
111 }
112
113 /**
114 * Show the tutorial

Callers 3

activateFunction · 0.45
initTutorialFunction · 0.45
main.tsFile · 0.45

Calls 3

prevMethod · 0.95
nextMethod · 0.95
completeMethod · 0.95

Tested by

no test coverage detected