feat(wip): 前端, 以及編譯前端

TODO: 修復 webpack (in mian.ts)
This commit is contained in:
CrescentLeaf
2025-08-30 15:36:36 +08:00
parent 5666bcba24
commit ca6aea2902
16 changed files with 674 additions and 9 deletions

View File

@@ -0,0 +1,17 @@
/**
* @callback callback
* @param { Event } event
*/
/**
* 绑定事件
* @param { React.Ref } ref
* @param { String } eventName
* @param { callback } callback
*/
export default function useEventListener(ref, eventName, callback) {
React.useEffect(() => {
ref.current.addEventListener(eventName, callback)
return () => ref.current.removeEventListener(eventName, callback)
}, [ref, eventName, callback])
}