mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core&ui: update type annotation for watchers
This commit is contained in:
1 parent
49693c27d4
commit
5d340608db
4 files changed
+9
-6
No files matched your search
@@ -258,7 +258,6 @@ export async function apply(ctx: Context) {
|
||||
LangSettingNode.range = range;
|
||||
ServerLangSettingNode.range = range;
|
||||
} catch (e) { /* Ignore */ }
|
||||
console.log('l', langs?.cc);
|
||||
ctx.on('system/setting', (args) => {
|
||||
if (args.hydrooj?.langs) {
|
||||
Object.assign(langs, parseLang(args.hydrooj.langs));
|
||||
|
||||
@@ -34,6 +34,11 @@ export interface EventMap extends LifecycleEvents, HandlerEvents {
|
||||
'app/started': () => void
|
||||
'app/ready': () => VoidReturn
|
||||
'app/exit': () => VoidReturn
|
||||
'app/before-reload': (entries: Set<string>) => VoidReturn
|
||||
'app/reload': (entries: Set<string>) => VoidReturn
|
||||
|
||||
'app/watch/change': (path: string) => VoidReturn
|
||||
'app/watch/unlink': (path: string) => VoidReturn
|
||||
|
||||
'database/connect': (db: Db) => void
|
||||
'database/config': () => VoidReturn
|
||||
|
||||
@@ -37,7 +37,7 @@ export default class Watcher extends Service {
|
||||
private declined: Set<string>;
|
||||
private stashed = new Set<string>();
|
||||
|
||||
constructor(public ctx, private config: any) {
|
||||
constructor(public ctx: Context, private config: any) {
|
||||
super(ctx, 'watcher', true);
|
||||
this.externals = new Set(Object.keys(require.cache));
|
||||
Context.service('watcher');
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import crypto from 'crypto';
|
||||
import esbuild from 'esbuild';
|
||||
import {
|
||||
ContestModel, fs, Handler, Logger, ObjectID, PERM, PRIV, ProblemModel, Schema,
|
||||
ContestModel, Context, fs, Handler, Logger, ObjectID, PERM, PRIV, ProblemModel, Schema,
|
||||
SettingModel, SystemModel, SystemSettings, UiContextBase,
|
||||
UserModel,
|
||||
} from 'hydrooj';
|
||||
@@ -60,7 +60,6 @@ export async function buildUI() {
|
||||
if (build.errors.length) console.error(build.errors);
|
||||
if (build.warnings.length) console.warn(build.warnings);
|
||||
const pages = build.outputFiles.map((i) => i.text);
|
||||
console.log('ui', SettingModel, JSON.stringify(SettingModel.langs));
|
||||
const payload = [`window.LANGS=${JSON.stringify(SettingModel.langs)};`, ...pages];
|
||||
|
||||
const c = crypto.createHash('sha1');
|
||||
@@ -219,7 +218,7 @@ class RichMediaHandler extends Handler {
|
||||
}
|
||||
}
|
||||
|
||||
export function apply(ctx) {
|
||||
export function apply(ctx: Context) {
|
||||
if (process.env.HYDRO_CLI) return;
|
||||
ctx.Route('wiki_help', '/wiki/help', WikiHelpHandler);
|
||||
ctx.Route('wiki_about', '/wiki/about', WikiAboutHandler);
|
||||
@@ -237,7 +236,7 @@ export function apply(ctx) {
|
||||
debouncedBuildUI();
|
||||
updateLogo();
|
||||
};
|
||||
ctx.on('system/setting', triggerHotUpdate);
|
||||
ctx.on('system/setting', () => triggerHotUpdate());
|
||||
ctx.on('app/watch/change', triggerHotUpdate);
|
||||
ctx.on('app/watch/unlink', triggerHotUpdate);
|
||||
}
|
||||
Reference in new issue
Block a user