This commit is contained in:
Dany LE 2021-11-24 22:37:49 +01:00
parent 3a24df169c
commit 3c67b1c134
6 changed files with 20 additions and 20 deletions

12
d.ts/antos.d.ts vendored
View File

@ -920,7 +920,7 @@ declare namespace OS {
* @export * @export
* @interface AnnouncementDataType * @interface AnnouncementDataType
*/ */
interface AnnouncementDataType { interface AnnouncementDataType<T> {
/** /**
* message string * message string
* *
@ -962,7 +962,7 @@ declare namespace OS {
* @type {*} * @type {*}
* @memberof AppAnnouncementDataType * @memberof AppAnnouncementDataType
*/ */
u_data?: any; u_data?: T;
} }
/** /**
* Observable entry type definition * Observable entry type definition
@ -1114,10 +1114,10 @@ declare namespace OS {
* *
* @export * @export
* @param {string} e event name * @param {string} e event name
* @param {(d: API.AnnouncementDataType) => void} f event callback * @param {(d: API.AnnouncementDataType<any>) => void} f event callback
* @param {GUI.BaseModel} a the process (Application/service) related to the 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<any>) => void, a: BaseModel): void;
/** /**
* Trigger a global event * Trigger a global event
* *
@ -4716,11 +4716,11 @@ declare namespace OS {
* *
* @protected * @protected
* @param {string} e event name * @param {string} e event name
* @param {(d: API.AnnouncementDataType) => void} f event callback * @param {(d: API.AnnouncementDataType<any>) => void} f event callback
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
subscribe(e: string, f: (d: API.AnnouncementDataType) => void): void; subscribe(e: string, f: (d: API.AnnouncementDataType<any>) => void): void;
/** /**
* Open a dialog * Open a dialog
* *

Binary file not shown.

View File

@ -25,7 +25,7 @@ namespace OS {
* @export * @export
* @interface AnnouncementDataType * @interface AnnouncementDataType
*/ */
export interface AnnouncementDataType { export interface AnnouncementDataType<T> {
/** /**
* message string * message string
@ -73,7 +73,7 @@ namespace OS {
* @type {*} * @type {*}
* @memberof AppAnnouncementDataType * @memberof AppAnnouncementDataType
*/ */
u_data?: any; u_data?: T;
} }
/** /**
* Observable entry type definition * Observable entry type definition
@ -308,10 +308,10 @@ namespace OS {
* *
* @export * @export
* @param {string} e event name * @param {string} e event name
* @param {(d: API.AnnouncementDataType) => void} f event callback * @param {(d: API.AnnouncementDataType<any>) => void} f event callback
* @param {GUI.BaseModel} a the process (Application/service) related to the 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<any>) => void, a: BaseModel): void {
if (!announcer.listeners[a.pid]) { if (!announcer.listeners[a.pid]) {
announcer.listeners[a.pid] = []; announcer.listeners[a.pid] = [];
} }
@ -373,7 +373,7 @@ namespace OS {
* @param {*} [d] user data * @param {*} [d] user data
*/ */
export function ostrigger(e: string, m: string| FormattedString, d?: any): void { export function ostrigger(e: string, m: string| FormattedString, d?: any): void {
const aob: API.AnnouncementDataType = {} as API.AnnouncementDataType; const aob: API.AnnouncementDataType<any> = {} as API.AnnouncementDataType<any>;
aob.id = 0; aob.id = 0;
aob.message = m; aob.message = m;
aob.u_data = d; aob.u_data = d;

View File

@ -525,11 +525,11 @@ namespace OS {
* *
* @protected * @protected
* @param {string} e event name * @param {string} e event name
* @param {(d: API.AnnouncementDataType) => void} f event callback * @param {(d: API.AnnouncementDataType<any>) => void} f event callback
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
subscribe(e: string, f: (d: API.AnnouncementDataType) => void): void { subscribe(e: string, f: (d: API.AnnouncementDataType<any>) => void): void {
return announcer.on(e, f, this); return announcer.on(e, f, this);
} }
@ -598,7 +598,7 @@ namespace OS {
u_data?: any u_data?: any
): void { ): void {
const mt = this.meta(); const mt = this.meta();
const data: API.AnnouncementDataType = {} as API.AnnouncementDataType; const data: API.AnnouncementDataType<any> = {} as API.AnnouncementDataType<any>;
data.icon = undefined; data.icon = undefined;
if (mt && mt.icon) { if (mt && mt.icon) {
data.icon = `${mt.path}/${mt.icon}`; data.icon = `${mt.path}/${mt.icon}`;

View File

@ -1058,13 +1058,13 @@ namespace OS {
}; };
dkfetch(desktop); dkfetch(desktop);
announcer.observable.on("VFS", function (d) { announcer.observable.on("VFS", function (d: API.AnnouncementDataType<API.VFS.BaseFileHandle>) {
if (["read", "publish", "download"].includes(d.data.m)) { if (["read", "publish", "download"].includes(d.message as string)) {
return; return;
} }
if ( if (
d.data.file.hash() === fp.hash() || d.u_data.hash() === fp.hash() ||
d.data.file.parent().hash() === fp.hash() d.u_data.parent().hash() === fp.hash()
) { ) {
return dkfetch(desktop); return dkfetch(desktop);
} }

View File

@ -115,7 +115,7 @@ namespace OS {
* @param {API.AnnouncementDataType} o * @param {API.AnnouncementDataType} o
* @memberof PushNotification * @memberof PushNotification
*/ */
private addLog(s: string, o: API.AnnouncementDataType): void { private addLog(s: string, o: API.AnnouncementDataType<any>): void {
const logtime = new Date(); const logtime = new Date();
const log = { const log = {
type: s, type: s,
@ -144,7 +144,7 @@ namespace OS {
* @param {API.AnnouncementDataType} o * @param {API.AnnouncementDataType} o
* @memberof PushNotification * @memberof PushNotification
*/ */
private pushout(s: string, o: API.AnnouncementDataType): void { private pushout(s: string, o: API.AnnouncementDataType<any>): void {
const d = { const d = {
text: `[${s}] ${o.name} (${o.id}): ${o.message}`, text: `[${s}] ${o.name} (${o.id}): ${o.message}`,
icon: o.icon, icon: o.icon,