Options
All
  • Public
  • Public/Protected
  • All
Menu

A ng service interface mainly handles application's background process executions. Despite the ng framework provides you an asynchronous execution mechanism via Promise or Observer already, this service aims to make all those asynchronous executions easily monitorable by the user. For example, if your application needs to execute multiple asynchronous user's tasks such as saving multiple documents to the backend server at the same time, by using this service, it will keep record of those processes and give you the information about which one is running or is complete at any time.

author

shiorin, tee4cute

see

BackgroundProcessManager

Hierarchy

  • IBackgroundProcessManager

Implemented by

Index

Methods

execute

  • execute(processFunc: Function, option?: any): Promise<any>
  • Execute a new background process which will perform the given processFunc.

    Parameters

    • processFunc: Function

      A function which will be performed asynchronously.

    • Optional option: any

      A configuration object. This depends on each implementation of this interface. But, at least, it should contain the following properties:
      { "type": "string", "name": "string" }

    Returns Promise<any>

    A Promise which will be resolved when the execution is done and its result is the value returned from the given processFunc. If the given processFunc returns a Promise, this method will return that Promise directly.

getRunningProcesses

  • getRunningProcesses(typeName: string, name: string): any[]
  • Get models of running processes by the given typeName and name. If you want to get all running process models in the system, just pass null into all parameters.

    Parameters

    • typeName: string

      A process type name. Passing null means no filter or including all type names.

    • name: string

      A process name. Passing null means no filter or including all process names.

    Returns any[]

    An array of running process models according to the given typeName and name. This method will return an empty array if no matching running process found.

getRunningProcessesCount

  • getRunningProcessesCount(typeName: string, name: string): number
  • Get the running processes count by the given typeName and name. If you want to count all running processes in the system, just pass null into all parameters. The returning value of this method must be the same as array's length returned from getRunningProcesses method.

    Parameters

    • typeName: string

      A process type name. Passing null means no filter or including all type names.

    • name: string

      A process name. Passing null means no filter or including all process names.

    Returns number

    A number of running processes according to the given typeName and name. This method will return 0 if no matching running process found.

Generated using TypeDoc