mirror of
https://github.com/motajs/template.git
synced 2026-11-21 12:14:31 +08:00
refactor: Delete global loading & hook object
This commit is contained in:
1 parent
7c155be5ce
commit
d8fa4b8507
16 files changed
+33
-978
No files matched your search
@@ -9,7 +9,6 @@ import {
|
||||
import { logger } from '@motajs/common';
|
||||
import { IRenderItem, IRenderTreeRoot } from '@motajs/render';
|
||||
import { Hotkey, gameKey } from '@motajs/system';
|
||||
import { loading } from '@user/data-base';
|
||||
import {
|
||||
ComponentInternalInstance,
|
||||
getCurrentInstance,
|
||||
@@ -65,18 +64,6 @@ export function onOrientationChange(hook: OrientationHook) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 当游戏加载完成时执行函数,如果调用此函数时游戏已经加载,那么会立刻调用传入的钩子函数
|
||||
* @param hook 当游戏加载完成时执行的函数
|
||||
*/
|
||||
export function onLoaded(hook: () => void) {
|
||||
if (!loading.loaded) {
|
||||
loading.once('loaded', hook);
|
||||
} else {
|
||||
hook();
|
||||
}
|
||||
}
|
||||
|
||||
type KeyUsing = [Hotkey, symbol];
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user