visual-song 0.10.7 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +8 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6113,6 +6113,7 @@ const _generateUID = ()=>{
|
|
|
6113
6113
|
const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, mainLoop, backgroundColor, vertexShader, primitiveMode, vertexCount, audioFile, initializedCallback }, ref) {
|
|
6114
6114
|
const canvasRef = useRef(null);
|
|
6115
6115
|
const canvasWrapperRef = useRef(null);
|
|
6116
|
+
const glContextRef = useRef(null);
|
|
6116
6117
|
const module = useRef(null);
|
|
6117
6118
|
useImperativeHandle(ref, ()=>({
|
|
6118
6119
|
resumeMainLoop () {
|
|
@@ -6303,6 +6304,7 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, mainLoo
|
|
|
6303
6304
|
module.current = tempModule;
|
|
6304
6305
|
const temp_buffer_size = 1024;
|
|
6305
6306
|
module.current.initialize(temp_buffer_size, temp_buffer_size, `#${canvasRef.current.id}`);
|
|
6307
|
+
glContextRef.current = canvasRef.current.getContext('webgl2');
|
|
6306
6308
|
if (mainLoop !== undefined) {
|
|
6307
6309
|
if (mainLoop) {
|
|
6308
6310
|
module.current.resumeMainLoop();
|
|
@@ -6363,21 +6365,14 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, mainLoo
|
|
|
6363
6365
|
}
|
|
6364
6366
|
function destroy() {
|
|
6365
6367
|
if (module.current) {
|
|
6366
|
-
// const canvas: HTMLCanvasElement | null = (module.current as any)["canvas"];
|
|
6367
6368
|
module.current.deInitialize();
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
// (canvasRef.current.getContext('experimental-webgl') as (WebGLRenderingContext | null));
|
|
6374
|
-
// const ext = gl && (gl as any).getExtension && (gl as any).getExtension('WEBGL_lose_context');
|
|
6375
|
-
// if (ext && typeof ext.loseContext === 'function') {
|
|
6376
|
-
// try { ext.loseContext(); } catch {}
|
|
6377
|
-
// }
|
|
6378
|
-
// }
|
|
6379
|
-
module.current = null;
|
|
6369
|
+
if (glContextRef.current) {
|
|
6370
|
+
console.log("loseContext: ", glContextRef.current);
|
|
6371
|
+
glContextRef.current.getExtension('WEBGL_lose_context').loseContext();
|
|
6372
|
+
glContextRef.current = null;
|
|
6373
|
+
}
|
|
6380
6374
|
}
|
|
6375
|
+
module.current = null;
|
|
6381
6376
|
}
|
|
6382
6377
|
return /*#__PURE__*/ jsx("div", {
|
|
6383
6378
|
ref: canvasWrapperRef,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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