diff --git a/d.ts/antos.d.ts b/d.ts/antos.d.ts index 74b0f5c..5b16697 100644 --- a/d.ts/antos.d.ts +++ b/d.ts/antos.d.ts @@ -920,7 +920,7 @@ declare namespace OS { * @export * @interface AnnouncementDataType */ - interface AnnouncementDataType { + interface AnnouncementDataType { /** * message string * @@ -962,7 +962,7 @@ declare namespace OS { * @type {*} * @memberof AppAnnouncementDataType */ - u_data?: any; + u_data?: T; } /** * Observable entry type definition @@ -1114,10 +1114,10 @@ declare namespace OS { * * @export * @param {string} e event name - * @param {(d: API.AnnouncementDataType) => void} f event callback + * @param {(d: API.AnnouncementDataType) => void} f event callback * @param {GUI.BaseModel} a the process (Application/service) related to the callback */ - function on(e: string, f: (d: API.AnnouncementDataType) => void, a: BaseModel): void; + function on(e: string, f: (d: API.AnnouncementDataType) => void, a: BaseModel): void; /** * Trigger a global event * @@ -4716,11 +4716,11 @@ declare namespace OS { * * @protected * @param {string} e event name - * @param {(d: API.AnnouncementDataType) => void} f event callback + * @param {(d: API.AnnouncementDataType) => void} f event callback * @returns {void} * @memberof BaseModel */ - subscribe(e: string, f: (d: API.AnnouncementDataType) => void): void; + subscribe(e: string, f: (d: API.AnnouncementDataType) => void): void; /** * Open a dialog * diff --git a/release/antos-1.2.1.tar.gz b/release/antos-1.2.1.tar.gz index 8661765..9c3dc00 100644 Binary files a/release/antos-1.2.1.tar.gz and b/release/antos-1.2.1.tar.gz differ diff --git a/src/core/Announcerment.ts b/src/core/Announcerment.ts index 53f4f51..d2d42c9 100644 --- a/src/core/Announcerment.ts +++ b/src/core/Announcerment.ts @@ -25,7 +25,7 @@ namespace OS { * @export * @interface AnnouncementDataType */ - export interface AnnouncementDataType { + export interface AnnouncementDataType { /** * message string @@ -73,7 +73,7 @@ namespace OS { * @type {*} * @memberof AppAnnouncementDataType */ - u_data?: any; + u_data?: T; } /** * Observable entry type definition @@ -308,10 +308,10 @@ namespace OS { * * @export * @param {string} e event name - * @param {(d: API.AnnouncementDataType) => void} f event callback + * @param {(d: API.AnnouncementDataType) => void} f event callback * @param {GUI.BaseModel} a the process (Application/service) related to the callback */ - export function on(e: string, f: (d: API.AnnouncementDataType) => void, a: BaseModel): void { + export function on(e: string, f: (d: API.AnnouncementDataType) => void, a: BaseModel): void { if (!announcer.listeners[a.pid]) { announcer.listeners[a.pid] = []; } @@ -373,7 +373,7 @@ namespace OS { * @param {*} [d] user data */ export function ostrigger(e: string, m: string| FormattedString, d?: any): void { - const aob: API.AnnouncementDataType = {} as API.AnnouncementDataType; + const aob: API.AnnouncementDataType = {} as API.AnnouncementDataType; aob.id = 0; aob.message = m; aob.u_data = d; diff --git a/src/core/BaseModel.ts b/src/core/BaseModel.ts index a7420bc..23e85d5 100644 --- a/src/core/BaseModel.ts +++ b/src/core/BaseModel.ts @@ -525,11 +525,11 @@ namespace OS { * * @protected * @param {string} e event name - * @param {(d: API.AnnouncementDataType) => void} f event callback + * @param {(d: API.AnnouncementDataType) => void} f event callback * @returns {void} * @memberof BaseModel */ - subscribe(e: string, f: (d: API.AnnouncementDataType) => void): void { + subscribe(e: string, f: (d: API.AnnouncementDataType) => void): void { return announcer.on(e, f, this); } @@ -598,7 +598,7 @@ namespace OS { u_data?: any ): void { const mt = this.meta(); - const data: API.AnnouncementDataType = {} as API.AnnouncementDataType; + const data: API.AnnouncementDataType = {} as API.AnnouncementDataType; data.icon = undefined; if (mt && mt.icon) { data.icon = `${mt.path}/${mt.icon}`; diff --git a/src/core/gui.ts b/src/core/gui.ts index 32c2d72..59ed0ff 100644 --- a/src/core/gui.ts +++ b/src/core/gui.ts @@ -1058,13 +1058,13 @@ namespace OS { }; dkfetch(desktop); - announcer.observable.on("VFS", function (d) { - if (["read", "publish", "download"].includes(d.data.m)) { + announcer.observable.on("VFS", function (d: API.AnnouncementDataType) { + if (["read", "publish", "download"].includes(d.message as string)) { return; } if ( - d.data.file.hash() === fp.hash() || - d.data.file.parent().hash() === fp.hash() + d.u_data.hash() === fp.hash() || + d.u_data.parent().hash() === fp.hash() ) { return dkfetch(desktop); } diff --git a/src/packages/Syslog/PushNotification.ts b/src/packages/Syslog/PushNotification.ts index 853ff70..c6760b2 100644 --- a/src/packages/Syslog/PushNotification.ts +++ b/src/packages/Syslog/PushNotification.ts @@ -115,7 +115,7 @@ namespace OS { * @param {API.AnnouncementDataType} o * @memberof PushNotification */ - private addLog(s: string, o: API.AnnouncementDataType): void { + private addLog(s: string, o: API.AnnouncementDataType): void { const logtime = new Date(); const log = { type: s, @@ -144,7 +144,7 @@ namespace OS { * @param {API.AnnouncementDataType} o * @memberof PushNotification */ - private pushout(s: string, o: API.AnnouncementDataType): void { + private pushout(s: string, o: API.AnnouncementDataType): void { const d = { text: `[${s}] ${o.name} (${o.id}): ${o.message}`, icon: o.icon,