mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 09:48:21 +01:00
minor improvement on GUI API
This commit is contained in:
parent
de5878c349
commit
9a12e9176f
@ -317,7 +317,8 @@ namespace OS {
|
||||
return;
|
||||
}
|
||||
if (it.type === "app" && it.app) {
|
||||
return launch(it.app, []);
|
||||
launch(it.app, []);
|
||||
return;
|
||||
}
|
||||
if (it.type === "app") {
|
||||
return announcer.osinfo(
|
||||
@ -331,7 +332,8 @@ namespace OS {
|
||||
);
|
||||
}
|
||||
if (apps.length === 1) {
|
||||
return launch(apps[0].app, [it]);
|
||||
launch(apps[0].app, [it]);
|
||||
return;
|
||||
}
|
||||
const list = apps.map((e) => ({
|
||||
text: e.app,
|
||||
@ -364,7 +366,7 @@ namespace OS {
|
||||
"This method is used for developing only, please use the launch method instead"
|
||||
);
|
||||
unloadApp(app);
|
||||
return launch(app, args);
|
||||
launch(app, args);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -529,32 +531,37 @@ namespace OS {
|
||||
* @param {string} app application class name
|
||||
* @param {AppArgumentsType[]} args application arguments
|
||||
*/
|
||||
export function launch(app: string, args: AppArgumentsType[]): void {
|
||||
export function launch(app: string, args: AppArgumentsType[]): Promise<OS.PM.ProcessType> {
|
||||
return new Promise((resolve, reject) => {
|
||||
if (!application[app]) {
|
||||
// first load it
|
||||
loadApp(app)
|
||||
.then((a) =>
|
||||
{
|
||||
.then((a) => {
|
||||
if (!application[app]) {
|
||||
return announcer.oserror(
|
||||
const e = API.throwe(__("Application not found"));
|
||||
announcer.oserror(
|
||||
__("{0} is not an application", app),
|
||||
API.throwe(__("Application not found"))
|
||||
);
|
||||
e);
|
||||
return reject(e);
|
||||
}
|
||||
PM.createProcess(
|
||||
app,
|
||||
application[app],
|
||||
args
|
||||
).catch((e) =>
|
||||
).catch((e) => {
|
||||
announcer.osfail(
|
||||
__("Unable to launch: {0}", app),
|
||||
e
|
||||
)
|
||||
)
|
||||
);
|
||||
return reject(e);
|
||||
}
|
||||
).then((p: PM.ProcessType) => resolve(p));
|
||||
}
|
||||
)
|
||||
.catch((e) =>
|
||||
announcer.osfail(__("Unable to launch: {0}", app), e)
|
||||
.catch((e) => {
|
||||
announcer.osfail(__("Unable to launch: {0}", app), e);
|
||||
reject(e);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// now launch it
|
||||
@ -563,16 +570,22 @@ namespace OS {
|
||||
app,
|
||||
application[app],
|
||||
args
|
||||
).catch((e: Error) =>
|
||||
announcer.osfail(__("Unable to launch: {0}", app), e)
|
||||
).catch((e: Error) => {
|
||||
announcer.osfail(__("Unable to launch: {0}", app), e);
|
||||
return reject(e);
|
||||
}
|
||||
|
||||
);
|
||||
} else {
|
||||
const e = API.throwe(__("Application not found"));
|
||||
announcer.osfail(
|
||||
__("Unable to find: {0}", app),
|
||||
API.throwe("Application not found")
|
||||
e
|
||||
);
|
||||
return reject(e);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
|
2
src/libs/jquery-3.6.0.min.js
vendored
Normal file
2
src/libs/jquery-3.6.0.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -140,7 +140,7 @@ namespace OS {
|
||||
* @memberof PushNotification
|
||||
*/
|
||||
private showLogReport(): void {
|
||||
return this._gui.launch("Syslog", []);
|
||||
this._gui.launch("Syslog", []);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user