MCPcopy Create free account
hub / github.com/dashrobotco/robot-components / initialize

Method initialize

app/nodegrid/page.tsx:128–139  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

126 private audioBuffer: AudioBuffer | null = null;
127
128 async initialize() {
129 if (this.audioContext) return;
130
131 try {
132 this.audioContext = new (window.AudioContext || (window as unknown as { webkitAudioContext: typeof AudioContext }).webkitAudioContext)();
133 const response = await fetch('/hoverfx2.mp3');
134 const arrayBuffer = await response.arrayBuffer();
135 this.audioBuffer = await this.audioContext.decodeAudioData(arrayBuffer);
136 } catch (e) {
137 console.warn('Failed to initialize sound:', e);
138 }
139 }
140
141 play(volume: number = 0.035, pitch: number = 0.8) {
142 if (!this.audioContext || !this.audioBuffer) return;

Callers 2

PhysicsPanelFunction · 0.45
FloatingPanelFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected