From 4b7a00080caadcba009b4767f7756bc208b5d089 Mon Sep 17 00:00:00 2001 From: Valentin Popov Date: Thu, 20 Feb 2020 16:15:14 +0400 Subject: Finished class "ActivityManager" structure Signed-off-by: Valentin Popov --- dist/activity-manager.d.ts | 18 ++++++++++++------ dist/types/index.d.ts | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 dist/types/index.d.ts diff --git a/dist/activity-manager.d.ts b/dist/activity-manager.d.ts index 75f2193..4a2d766 100644 --- a/dist/activity-manager.d.ts +++ b/dist/activity-manager.d.ts @@ -1,6 +1,12 @@ +import { IActivitySpec } from "./types"; import { Service } from "./service"; import { Subscription } from "./subscription"; +export interface ICreateDummyCallback { + activity: { name: string }; + isDummyActivity: boolean; +} + export declare class ActivityManager { public constructor(service: Service, idleTimeout: number); @@ -20,19 +26,19 @@ export declare class ActivityManager { private _idleTimer: NodeJS.Timeout | null; - public adopt(): any + public adopt(activity: Record, callback?: (payload: Record) => void): void; - public complete(): any; + public complete(activity: Record, options?: Record, callback?: (payload: Record) => void): boolean | void; - public create(): any; + public create(spec: string | Record, callback: (payload: any) => void): void; private _add(id: string, activity: Subscription): void; - private _createActual(): any; + private _createActual(activitySpec: IActivitySpec, callback?: (payload: any) => void): void; - private _createDummy(): any; + private _createDummy(jobId: string, callback?: (payload: ICreateDummyCallback) => void): void; - private _createInternal(): any; + private _createInternal(jobId: string, callback?: (payload: any) => void): void; private _remove(id: string): void; diff --git a/dist/types/index.d.ts b/dist/types/index.d.ts new file mode 100644 index 0000000..4b749ca --- /dev/null +++ b/dist/types/index.d.ts @@ -0,0 +1,18 @@ +export interface IActivitySpec { + readonly activity: IActivity; + readonly replace?: boolean; + readonly start?: boolean; + readonly subscribe?: boolean; +} + +export interface IActivity { + readonly description: string; + readonly name: string; + readonly type?: IType; +} + +export interface IType { + readonly explicit?: boolean; + readonly foreground?: boolean; + readonly persist?: boolean; +} -- cgit v1.2.3