visual-song 0.13.7 → 0.13.8
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.d.ts +2 -2
- package/dist/index.js +10 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -48,7 +48,7 @@ type VisualSongAudioRef = {
|
|
|
48
48
|
setLoop(loop: boolean): void;
|
|
49
49
|
};
|
|
50
50
|
declare function useVisualSongAudio(file?: File): VisualSongAudioRef;
|
|
51
|
-
declare function
|
|
51
|
+
declare function useMainLoop(): (loop: boolean) => void;
|
|
52
52
|
type VisualSongRef = {
|
|
53
53
|
IsInitialized(): boolean;
|
|
54
54
|
getBackgroundColor(): Float32Array;
|
|
@@ -81,5 +81,5 @@ type Props = {
|
|
|
81
81
|
};
|
|
82
82
|
declare const VisualSong: react.ForwardRefExoticComponent<Props & react.RefAttributes<VisualSongRef>>;
|
|
83
83
|
|
|
84
|
-
export { EasingType, RenderMode, VisualSong, VisualSongProvider,
|
|
84
|
+
export { EasingType, RenderMode, VisualSong, VisualSongProvider, useMainLoop, useVisualSongAudio };
|
|
85
85
|
export type { VisualSongAudioRef, VisualSongRef };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { forwardRef, useState, useEffect, createContext, useContext, useRef, useImperativeHandle } from 'react';
|
|
2
|
+
import { forwardRef, useState, useEffect, createContext, useContext, useCallback, useRef, useImperativeHandle } from 'react';
|
|
3
3
|
|
|
4
4
|
function _define_property(obj, key, value) {
|
|
5
5
|
if (key in obj) {
|
|
@@ -6312,14 +6312,15 @@ function useVisualSongAudio(file) {
|
|
|
6312
6312
|
}
|
|
6313
6313
|
};
|
|
6314
6314
|
}
|
|
6315
|
-
function
|
|
6315
|
+
function useMainLoop() {
|
|
6316
6316
|
const { module } = useContext(VisualSongContext);
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
module.resumeMainLoop();
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6317
|
+
return useCallback((loop)=>{
|
|
6318
|
+
if (!module) return;
|
|
6319
|
+
if (loop) module.resumeMainLoop();
|
|
6320
|
+
else module.pauseMainLoop();
|
|
6321
|
+
}, [
|
|
6322
|
+
module
|
|
6323
|
+
]);
|
|
6323
6324
|
}
|
|
6324
6325
|
const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, backgroundColor, vertexShader, primitiveMode, vertexCount, useSinWaveOnly, renderMode, initializedCallback }, ref) {
|
|
6325
6326
|
const canvasRef = useRef(null);
|
|
@@ -6600,4 +6601,4 @@ const VisualSong = /*#__PURE__*/ forwardRef(function VisualSong({ style, backgro
|
|
|
6600
6601
|
});
|
|
6601
6602
|
});
|
|
6602
6603
|
|
|
6603
|
-
export { EasingType, RenderMode, VisualSong, VisualSongProvider,
|
|
6604
|
+
export { EasingType, RenderMode, VisualSong, VisualSongProvider, useMainLoop, useVisualSongAudio };
|