@e-mc/task
v0.10.3
Published
Task constructor for E-mc.
Downloads
68
Readme
@e-mc/task
- NodeJS 16
- ES2020
General Usage
Interface
import type { IFileManager, IHost, ModuleConstructor } from "./index";
import type { ExternalAsset, IFileThread } from "./asset";
import type { IClient } from "./core";
import type { TaskModule } from "./settings";
import type { Command, SpawnResult } from "./task";
interface ITask extends IClient<IHost, TaskModule> {
using?(data: IFileThread): Promise<unknown>;
collect?(items: unknown[], preceding?: boolean): Promise<SpawnResult>[];
map?(tasks: Command[]): Promise<SpawnResult | void>[];
series?(tasks: Command[]): Promise<unknown>;
parallel?(tasks: Command[]): Promise<unknown>;
spawn?(task: Record<string | number | symbol, unknown>, callback: (result?: SpawnResult) => void): void;
execute?(manager: IFileManager, task: Record<string | number | symbol, unknown>, callback: (value?: unknown) => void): void;
}
interface TaskConstructor extends ModuleConstructor {
finalize(this: IHost, instance: ITask, assets: ExternalAsset[]): Promise<void>;
readonly prototype: ITask;
new(module?: TaskModule, ...args: unknown[]): ITask;
}
Settings
import type { PermittedDirectories } from "./core";
interface TaskModule {
// handler: "@pi-r/gulp";
settings?: {
broadcast_id?: string | string[];
users?: Record<string, Record<string, unknown>>;
exec?: {
uid?: number;
gid?: number;
};
};
permission?: PermittedDirectories;
}
Example usage
NOTE: Usage without a Host is conducted through static methods. The using class method is called by the Host to perform the transformation.
References
- https://www.unpkg.com/@e-mc/[email protected]/lib/asset.d.ts
- https://www.unpkg.com/@e-mc/[email protected]/lib/core.d.ts
- https://www.unpkg.com/@e-mc/[email protected]/lib/settings.d.ts
- https://www.unpkg.com/@e-mc/[email protected]/lib/task.d.ts
LICENSE
BSD 3-Clause