Fix some nasty bug

pull/3/head
Zef Hemel 2022-04-01 15:03:12 +02:00
parent b858917c98
commit 7f647758c2
2 changed files with 14 additions and 17 deletions

View File

@ -17,7 +17,7 @@ export class CompleterHook implements Hook<CompleterHookT> {
continue;
}
for (const [functionName, functionDef] of Object.entries(
plug.manifest.functions
plug.manifest.functions
)) {
if (functionDef.isCompleter) {
completerPromises.push(plug.invoke(functionName, []));
@ -29,7 +29,7 @@ export class CompleterHook implements Hook<CompleterHookT> {
if (result) {
if (actualResult) {
console.error(
"Got completion results from multiple sources, cannot deal with that"
"Got completion results from multiple sources, cannot deal with that"
);
return null;
}

View File

@ -27,22 +27,19 @@ export class PathPageNavigator {
subscribe(
pageLoadCallback: (pageName: string, pos: number) => Promise<void>
): void {
const cb = (event?: PopStateEvent) => {
const gotoPage = this.getCurrentPage();
if (!gotoPage) {
return;
const cb = (event?: PopStateEvent) => {
const gotoPage = this.getCurrentPage();
if (!gotoPage) {
return;
}
safeRun(async () => {
await pageLoadCallback(this.getCurrentPage(), event && event.state.pos);
if (this.navigationResolve) {
this.navigationResolve();
}
safeRun(async () => {
await pageLoadCallback(
this.getCurrentPage(),
event && event.state.pos
);
if (this.navigationResolve) {
this.navigationResolve();
}
});
};
window.addEventListener("popstate", cb);
});
};
window.addEventListener("popstate", cb);
cb();
}