npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

task-wrapper

v1.1.0

Published

Index -----

Downloads

5

Readme

Index

Classes

Interfaces

Type aliases

Events


Type aliases

Job

Ƭ Job: function

Type declaration

▸(request?: E): R | Promise<R>

Parameters:

Param

Type

Optional request

E

Returns: R | Promise<R>


TaskData

Ƭ TaskData: object

Type declaration

Optional errors: []

Optional progress: undefined | number

Optional request: E

Optional result: R

Optional sessionId: undefined | string

Optional timeout: Timeout


Events

Controllable

Controllable:

Methods for controlling a task params: TaskData

params: TaskData

cancel

cancel(reason?: any): void

Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


reset

reset(): void

Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.

If the task is running a job, the job is first cancelled (cancel()).

Returns: void


restart

restart(request?: E): void

Resets the task (cancelling any running job) and starts it anew with the supplied request.

Parameters:

Param

Type

Description

Optional request

E

Returns: void


start

start(request?: E): Promise<RunningJob<E, R>>

Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.

Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>



Task

Task:

Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.

constructor

new Task(opts?: TaskOptions<E, R>): Task

Parameters:

Param

Type

Description

Optional opts

TaskOptions<E, R>

Returns: Task


<Optional> dataProxy

● dataProxy: DataProxy<TaskData<E, R>>


<Optional> job

● job: Job<E, R>


addListener

addListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


cancel

cancel(reason?: any): void

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


done

done(sessionId: string, result?: R): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional result

R

-

Returns: void


emit

emit(event: * string | symbol, ...args: *any[]): boolean

Parameters:

Param

Type

event

string | symbol

Rest args

any[]

Returns: boolean


error

error(sessionId: string, reason?: any): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional reason

any

-

Returns: void


eventNames

eventNames(): Array< string | symbol>

Returns: Array< string | symbol>


getMaxListeners

getMaxListeners(): number

Returns: number


listenerCount

listenerCount(type: * string | symbol*): number

Parameters:

Param

Type

type

string | symbol

Returns: number


listeners

listeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


off

off(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


on

on(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


once

once(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependListener

prependListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependOnceListener

prependOnceListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


rawListeners

rawListeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


removeAllListeners

removeAllListeners(event?: * string | symbol*): this

Parameters:

Param

Type

Optional event

string | symbol

Returns: this


removeListener

removeListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


reset

reset(): void

Returns: void


restart

restart(request?: E): Promise<RunningJob<E, R>>

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>


setMaxListeners

setMaxListeners(n: number): this

Parameters:

Param

Type

n

number

Returns: this


start

start(request?: E): Promise<RunningJob<E, R>>

Starts the task.

Parameters:

Param

Type

Description

Optional request

E

-

Returns: Promise<RunningJob<E, R>>


update

update(sessionId: string, progress: number): void

Parameters:

Param

Type

Description

sessionId

string

-

progress

number

Returns: void



Index

Classes

Interfaces

Type aliases

Events


Type aliases

Job

Ƭ Job: function

Type declaration

▸(request?: E): R | Promise<R>

Parameters:

Param

Type

Optional request

E

Returns: R | Promise<R>


TaskData

Ƭ TaskData: object

Type declaration

Optional errors: []

Optional progress: undefined | number

Optional request: E

Optional result: R

Optional sessionId: undefined | string

Optional timeout: Timeout


Events

Controllable

Controllable:

Methods for controlling a task params: TaskData

params: TaskData

cancel

cancel(reason?: any): void

Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


reset

reset(): void

Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.

If the task is running a job, the job is first cancelled (cancel()).

Returns: void


restart

restart(request?: E): void

Resets the task (cancelling any running job) and starts it anew with the supplied request.

Parameters:

Param

Type

Description

Optional request

E

Returns: void


start

start(request?: E): Promise<RunningJob<E, R>>

Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.

Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>



Task

Task:

Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.

constructor

new Task(opts?: TaskOptions<E, R>): Task

Parameters:

Param

Type

Description

Optional opts

TaskOptions<E, R>

Returns: Task


<Optional> dataProxy

● dataProxy: DataProxy<TaskData<E, R>>


<Optional> job

● job: Job<E, R>


addListener

addListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


cancel

cancel(reason?: any): void

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


done

done(sessionId: string, result?: R): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional result

R

-

Returns: void


emit

emit(event: * string | symbol, ...args: *any[]): boolean

Parameters:

Param

Type

event

string | symbol

Rest args

any[]

Returns: boolean


error

error(sessionId: string, reason?: any): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional reason

any

-

Returns: void


eventNames

eventNames(): Array< string | symbol>

Returns: Array< string | symbol>


getMaxListeners

getMaxListeners(): number

Returns: number


listenerCount

listenerCount(type: * string | symbol*): number

Parameters:

Param

Type

type

string | symbol

Returns: number


listeners

listeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


off

off(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


on

on(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


once

once(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependListener

prependListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependOnceListener

prependOnceListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


rawListeners

rawListeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


removeAllListeners

removeAllListeners(event?: * string | symbol*): this

Parameters:

Param

Type

Optional event

string | symbol

Returns: this


removeListener

removeListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


reset

reset(): void

Returns: void


restart

restart(request?: E): Promise<RunningJob<E, R>>

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>


setMaxListeners

setMaxListeners(n: number): this

Parameters:

Param

Type

n

number

Returns: this


start

start(request?: E): Promise<RunningJob<E, R>>

Starts the task.

Parameters:

Param

Type

Description

Optional request

E

-

Returns: Promise<RunningJob<E, R>>


update

update(sessionId: string, progress: number): void

Parameters:

Param

Type

Description

sessionId

string

-

progress

number

Returns: void



Index

Classes

Interfaces

Type aliases

Events


Type aliases

Job

Ƭ Job: function

Type declaration

▸(request?: E): R | Promise<R>

Parameters:

Param

Type

Optional request

E

Returns: R | Promise<R>


TaskData

Ƭ TaskData: object

Type declaration

Optional errors: []

Optional progress: undefined | number

Optional request: E

Optional result: R

Optional sessionId: undefined | string

Optional timeout: Timeout


Events

Controllable

Controllable:

Methods for controlling a task params: TaskData

params: TaskData

cancel

cancel(reason?: any): void

Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


reset

reset(): void

Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.

If the task is running a job, the job is first cancelled (cancel()).

Returns: void


restart

restart(request?: E): void

Resets the task (cancelling any running job) and starts it anew with the supplied request.

Parameters:

Param

Type

Description

Optional request

E

Returns: void


start

start(request?: E): Promise<RunningJob<E, R>>

Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.

Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>



Task

Task:

Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.

constructor

new Task(opts?: TaskOptions<E, R>): Task

Parameters:

Param

Type

Description

Optional opts

TaskOptions<E, R>

Returns: Task


<Optional> dataProxy

● dataProxy: DataProxy<TaskData<E, R>>


<Optional> job

● job: Job<E, R>


addListener

addListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


cancel

cancel(reason?: any): void

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


done

done(sessionId: string, result?: R): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional result

R

-

Returns: void


emit

emit(event: * string | symbol, ...args: *any[]): boolean

Parameters:

Param

Type

event

string | symbol

Rest args

any[]

Returns: boolean


error

error(sessionId: string, reason?: any): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional reason

any

-

Returns: void


eventNames

eventNames(): Array< string | symbol>

Returns: Array< string | symbol>


getMaxListeners

getMaxListeners(): number

Returns: number


listenerCount

listenerCount(type: * string | symbol*): number

Parameters:

Param

Type

type

string | symbol

Returns: number


listeners

listeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


off

off(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


on

on(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


once

once(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependListener

prependListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependOnceListener

prependOnceListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


rawListeners

rawListeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


removeAllListeners

removeAllListeners(event?: * string | symbol*): this

Parameters:

Param

Type

Optional event

string | symbol

Returns: this


removeListener

removeListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


reset

reset(): void

Returns: void


restart

restart(request?: E): Promise<RunningJob<E, R>>

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>


setMaxListeners

setMaxListeners(n: number): this

Parameters:

Param

Type

n

number

Returns: this


start

start(request?: E): Promise<RunningJob<E, R>>

Starts the task.

Parameters:

Param

Type

Description

Optional request

E

-

Returns: Promise<RunningJob<E, R>>


update

update(sessionId: string, progress: number): void

Parameters:

Param

Type

Description

sessionId

string

-

progress

number

Returns: void



Index

Classes

Interfaces

Type aliases

Events


Type aliases

Job

Ƭ Job: function

Type declaration

▸(request?: E): R | Promise<R>

Parameters:

Param

Type

Optional request

E

Returns: R | Promise<R>


TaskData

Ƭ TaskData: object

Type declaration

Optional errors: []

Optional progress: undefined | number

Optional request: E

Optional result: R

Optional sessionId: undefined | string

Optional timeout: Timeout


Events

Controllable

Controllable:

Methods for controlling a task params: TaskData

params: TaskData

cancel

cancel(reason?: any): void

Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


reset

reset(): void

Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.

If the task is running a job, the job is first cancelled (cancel()).

Returns: void


restart

restart(request?: E): void

Resets the task (cancelling any running job) and starts it anew with the supplied request.

Parameters:

Param

Type

Description

Optional request

E

Returns: void


start

start(request?: E): Promise<RunningJob<E, R>>

Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.

Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>



Task

Task:

Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.

constructor

new Task(opts?: TaskOptions<E, R>): Task

Parameters:

Param

Type

Description

Optional opts

TaskOptions<E, R>

Returns: Task


<Optional> dataProxy

● dataProxy: DataProxy<TaskData<E, R>>


<Optional> job

● job: Job<E, R>


addListener

addListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


cancel

cancel(reason?: any): void

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


done

done(sessionId: string, result?: R): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional result

R

-

Returns: void


emit

emit(event: * string | symbol, ...args: *any[]): boolean

Parameters:

Param

Type

event

string | symbol

Rest args

any[]

Returns: boolean


error

error(sessionId: string, reason?: any): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional reason

any

-

Returns: void


eventNames

eventNames(): Array< string | symbol>

Returns: Array< string | symbol>


getMaxListeners

getMaxListeners(): number

Returns: number


listenerCount

listenerCount(type: * string | symbol*): number

Parameters:

Param

Type

type

string | symbol

Returns: number


listeners

listeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


off

off(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


on

on(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


once

once(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependListener

prependListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependOnceListener

prependOnceListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


rawListeners

rawListeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


removeAllListeners

removeAllListeners(event?: * string | symbol*): this

Parameters:

Param

Type

Optional event

string | symbol

Returns: this


removeListener

removeListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


reset

reset(): void

Returns: void


restart

restart(request?: E): Promise<RunningJob<E, R>>

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>


setMaxListeners

setMaxListeners(n: number): this

Parameters:

Param

Type

n

number

Returns: this


start

start(request?: E): Promise<RunningJob<E, R>>

Starts the task.

Parameters:

Param

Type

Description

Optional request

E

-

Returns: Promise<RunningJob<E, R>>


update

update(sessionId: string, progress: number): void

Parameters:

Param

Type

Description

sessionId

string

-

progress

number

Returns: void



Index

Classes

Interfaces

Type aliases

Events


Type aliases

Job

Ƭ Job: function

Type declaration

▸(request?: E): R | Promise<R>

Parameters:

Param

Type

Optional request

E

Returns: R | Promise<R>


TaskData

Ƭ TaskData: object

Type declaration

Optional errors: []

Optional progress: undefined | number

Optional request: E

Optional result: R

Optional sessionId: undefined | string

Optional timeout: Timeout


Events

Controllable

Controllable:

Methods for controlling a task params: TaskData

params: TaskData

cancel

cancel(reason?: any): void

Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


reset

reset(): void

Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.

If the task is running a job, the job is first cancelled (cancel()).

Returns: void


restart

restart(request?: E): void

Resets the task (cancelling any running job) and starts it anew with the supplied request.

Parameters:

Param

Type

Description

Optional request

E

Returns: void


start

start(request?: E): Promise<RunningJob<E, R>>

Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.

Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>



Task

Task:

Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.

constructor

new Task(opts?: TaskOptions<E, R>): Task

Parameters:

Param

Type

Description

Optional opts

TaskOptions<E, R>

Returns: Task


<Optional> dataProxy

● dataProxy: DataProxy<TaskData<E, R>>


<Optional> job

● job: Job<E, R>


addListener

addListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


cancel

cancel(reason?: any): void

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


done

done(sessionId: string, result?: R): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional result

R

-

Returns: void


emit

emit(event: * string | symbol, ...args: *any[]): boolean

Parameters:

Param

Type

event

string | symbol

Rest args

any[]

Returns: boolean


error

error(sessionId: string, reason?: any): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional reason

any

-

Returns: void


eventNames

eventNames(): Array< string | symbol>

Returns: Array< string | symbol>


getMaxListeners

getMaxListeners(): number

Returns: number


listenerCount

listenerCount(type: * string | symbol*): number

Parameters:

Param

Type

type

string | symbol

Returns: number


listeners

listeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


off

off(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


on

on(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


once

once(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependListener

prependListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependOnceListener

prependOnceListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


rawListeners

rawListeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


removeAllListeners

removeAllListeners(event?: * string | symbol*): this

Parameters:

Param

Type

Optional event

string | symbol

Returns: this


removeListener

removeListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


reset

reset(): void

Returns: void


restart

restart(request?: E): Promise<RunningJob<E, R>>

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>


setMaxListeners

setMaxListeners(n: number): this

Parameters:

Param

Type

n

number

Returns: this


start

start(request?: E): Promise<RunningJob<E, R>>

Starts the task.

Parameters:

Param

Type

Description

Optional request

E

-

Returns: Promise<RunningJob<E, R>>


update

update(sessionId: string, progress: number): void

Parameters:

Param

Type

Description

sessionId

string

-

progress

number

Returns: void



Index

Classes

Interfaces

Type aliases

Events


Type aliases

Job

Ƭ Job: function

Type declaration

▸(request?: E): R | Promise<R>

Parameters:

Param

Type

Optional request

E

Returns: R | Promise<R>


TaskData

Ƭ TaskData: object

Type declaration

Optional errors: []

Optional progress: undefined | number

Optional request: E

Optional result: R

Optional sessionId: undefined | string

Optional timeout: Timeout


Events

Controllable

Controllable:

Methods for controlling a task params: TaskData

params: TaskData

cancel

cancel(reason?: any): void

Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


reset

reset(): void

Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.

If the task is running a job, the job is first cancelled (cancel()).

Returns: void


restart

restart(request?: E): void

Resets the task (cancelling any running job) and starts it anew with the supplied request.

Parameters:

Param

Type

Description

Optional request

E

Returns: void


start

start(request?: E): Promise<RunningJob<E, R>>

Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.

Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>



Task

Task:

Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.

constructor

new Task(opts?: TaskOptions<E, R>): Task

Parameters:

Param

Type

Description

Optional opts

TaskOptions<E, R>

Returns: Task


<Optional> animation

● animation: AnimOptions


<Optional> dataProxy

● dataProxy: DataProxy<TaskData<E, R>>


<Optional> job

● job: Job<E, R>


addListener

addListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


cancel

cancel(reason?: any): void

Parameters:

Param

Type

Description

Optional reason

any

Returns: void


done

done(sessionId: string, result?: R): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional result

R

-

Returns: void


emit

emit(event: * string | symbol, ...args: *any[]): boolean

Parameters:

Param

Type

event

string | symbol

Rest args

any[]

Returns: boolean


error

error(sessionId: string, reason?: any): void

Parameters:

Param

Type

Description

sessionId

string

-

Optional reason

any

-

Returns: void


eventNames

eventNames(): Array< string | symbol>

Returns: Array< string | symbol>


getMaxListeners

getMaxListeners(): number

Returns: number


listenerCount

listenerCount(type: * string | symbol*): number

Parameters:

Param

Type

type

string | symbol

Returns: number


listeners

listeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


off

off(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


on

on(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


once

once(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependListener

prependListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


prependOnceListener

prependOnceListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


rawListeners

rawListeners(event: * string | symbol*): Function[]

Parameters:

Param

Type

event

string | symbol

Returns: Function[]


removeAllListeners

removeAllListeners(event?: * string | symbol*): this

Parameters:

Param

Type

Optional event

string | symbol

Returns: this


removeListener

removeListener(event: * string | symbol, listener: *function): this

Parameters:

Param

Type

event

string | symbol

listener

function

Returns: this


reset

reset(): void

Returns: void


restart

restart(request?: E): Promise<RunningJob<E, R>>

Parameters:

Param

Type

Description

Optional request

E

Returns: Promise<RunningJob<E, R>>


setMaxListeners

setMaxListeners(n: number): this

Parameters:

Param

Type

n

number

Returns: this


start

start(request?: E): Promise<RunningJob<E, R>>

Starts the task.

Parameters:

Param

Type

Description

Optional request

E

-

Returns: Promise<RunningJob<E, R>>


update

update(sessionId: string, progress: number): void

Parameters:

Param

Type

Description

sessionId

string

-

progress

number

Returns: void



Index

Classes

Interfaces

Type aliases

Events


Type aliases

Job

Ƭ Job: function

Type declaration

▸(request: E): R | Promise<R>

Parameters:

| Param | Type | | ------ | ------ | | request | E |

Returns: R | Promise<R>


LoadTask

Ƭ LoadTask: Task<MasterDetailData<E, V>, IndexedItem<V>>


LoadTaskData

Ƭ LoadTaskData: TaskData<MasterDetailData<E, V>, IndexedItem<V>>


TaskData

Ƭ TaskData: object

Type declaration

Optional errors: []

Optional progress: undefined | number

Optional request: E

Optional result: R

Optional sessionId: undefined | string

Optional timeout: Timeout


Events

Controllable

Controllable:

Methods for controlling a task params: TaskData

params: TaskData

cancel

cancel(reason?: any): void

Instructs the task to terminate it's job if the job is currently running. fires: Controllable#cancel when the job is cancelled.

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | Optional reason | any | |

Returns: void


reset

reset(): void

Instructs the task to revert to its 'idle' state, at which point the Task can be restarted.

If the task is running a job, the job is first cancelled (cancel()).

Returns: void


restart

restart(request?: E): void

Resets the task (cancelling any running job) and starts it anew with the supplied request.

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | Optional request | E | |

Returns: void


start

start(request?: E): Promise<RunningJob<E, R>>

Requests the task to start the underlying job with the supplied parameters. The request is ignored if the task is already running.

Returns a RunningJob (promise) which can be used to complete the job (update / done / error). fires: Controllable#run to instruct the job to start

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | Optional request | E | |

Returns: Promise<RunningJob<E, R>>



Task

Task:

Encapsulates arbitrary 'work'. Provides an type: TaskData Fired when a running job is cancelled.

constructor

new Task(opts: TaskOptions<E, R>): Task

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | opts | TaskOptions<E, R> | |

Returns: Task


<Optional> animation

● animation: AnimOptions


<Optional> dataProxy

● dataProxy: DataProxy<TaskData<E, R>>


job

● job: Job<E, R>


addListener

addListener(event: * string | symbol*, listener: function): this

Parameters:

| Param | Type | | ------ | ------ | | event | string | symbol| | listener | function |

Returns: this


cancel

cancel(reason?: any): void

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | Optional reason | any | |

Returns: void


done

done(sessionId: string, result?: R): void

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | sessionId | string | - | | Optional result | R | - |

Returns: void


emit

emit(event: * string | symbol*, ...args: any[]): boolean

Parameters:

| Param | Type | | ------ | ------ | | event | string | symbol| | Rest args | any[] |

Returns: boolean


error

error(sessionId: string, reason?: any): void

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | sessionId | string | - | | Optional reason | any | - |

Returns: void


eventNames

eventNames(): Array< string | symbol>

Returns: Array< string | symbol>


getMaxListeners

getMaxListeners(): number

Returns: number


listenerCount

listenerCount(type: * string | symbol*): number

Parameters:

| Param | Type | | ------ | ------ | | type | string | symbol|

Returns: number


listeners

listeners(event: * string | symbol*): Function[]

Parameters:

| Param | Type | | ------ | ------ | | event | string | symbol|

Returns: Function[]


off

off(event: * string | symbol*, listener: function): this

Parameters:

| Param | Type | | ------ | ------ | | event | string | symbol| | listener | function |

Returns: this


on

on(event: * string | symbol*, listener: function): this

Parameters:

| Param | Type | | ------ | ------ | | event | string | symbol| | listener | function |

Returns: this


once

once(event: * string | symbol*, listener: function): this

Parameters:

| Param | Type | | ------ | ------ | | event | string | symbol| | listener | function |

Returns: this


prependListener

prependListener(event: * string | symbol*, listener: function): this

Parameters:

| Param | Type | | ------ | ------ | | event | string | symbol| | listener | function |

Returns: this


prependOnceListener

prependOnceListener(event: * string | symbol*, listener: function): this

Parameters:

| Param | Type | | ------ | ------ | | event | string | symbol| | listener | function |

Returns: this


rawListeners

rawListeners(event: * string | symbol*): Function[]

Parameters:

| Param | Type | | ------ | ------ | | event | string | symbol|

Returns: Function[]


removeAllListeners

removeAllListeners(event?: * string | symbol*): this

Parameters:

| Param | Type | | ------ | ------ | | Optional event | string | symbol|

Returns: this


removeListener

removeListener(event: * string | symbol*, listener: function): this

Parameters:

| Param | Type | | ------ | ------ | | event | string | symbol| | listener | function |

Returns: this


reset

reset(): void

Returns: void


restart

restart(request?: E): Promise<RunningJob<E, R>>

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | Optional request | E | |

Returns: Promise<RunningJob<E, R>>


setMaxListeners

setMaxListeners(n: number): this

Parameters:

| Param | Type | | ------ | ------ | | n | number |

Returns: this


start

start(request?: E): Promise<RunningJob<E, R>>

Starts the task.

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | Optional request | E | - |

Returns: Promise<RunningJob<E, R>>


update

update(sessionId: string, progress: number): void

Parameters:

| Param | Type | Description | | ------ | ------ | ------ | | sessionId | string | - | | progress | number | |

Returns: void