@twin.org/background-task-models 0.0.1-next.3 → 0.0.1-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/types/index.d.ts +0 -1
- package/dist/types/models/IBackgroundTaskConnector.d.ts +4 -3
- package/docs/changelog.md +1 -1
- package/docs/reference/index.md +0 -1
- package/docs/reference/interfaces/IBackgroundTaskConnector.md +11 -3
- package/package.json +1 -1
- package/dist/types/models/backgroundTaskHandler.d.ts +0 -4
- package/docs/reference/type-aliases/BackgroundTaskHandler.md +0 -19
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { IComponent } from "@twin.org/core";
|
|
2
2
|
import type { SortDirection } from "@twin.org/entity";
|
|
3
|
-
import type { BackgroundTaskHandler } from "./backgroundTaskHandler";
|
|
4
3
|
import type { IBackgroundTask } from "./IBackgroundTask";
|
|
5
4
|
import type { TaskStatus } from "./taskStatus";
|
|
6
5
|
/**
|
|
@@ -10,10 +9,12 @@ export interface IBackgroundTaskConnector extends IComponent {
|
|
|
10
9
|
/**
|
|
11
10
|
* Register a handler for a task.
|
|
12
11
|
* @param taskType The type of the task the handler can process.
|
|
13
|
-
* @param
|
|
12
|
+
* @param module The module the handler is in.
|
|
13
|
+
* @param method The method in the module to execute.
|
|
14
|
+
* @param stateChangeCallback The callback to execute when the task state is updated.
|
|
14
15
|
* @returns Nothing.
|
|
15
16
|
*/
|
|
16
|
-
registerHandler<T, U>(taskType: string,
|
|
17
|
+
registerHandler<T, U>(taskType: string, module: string, method: string, stateChangeCallback?: (task: IBackgroundTask<T, U>) => Promise<void>): Promise<void>;
|
|
17
18
|
/**
|
|
18
19
|
* Unregister a handler for a task.
|
|
19
20
|
* @param taskType The type of the task handler to remove.
|
package/docs/changelog.md
CHANGED
package/docs/reference/index.md
CHANGED
|
@@ -10,7 +10,7 @@ Interface describing a background task connector.
|
|
|
10
10
|
|
|
11
11
|
### registerHandler()
|
|
12
12
|
|
|
13
|
-
> **registerHandler**\<`T`, `U`\>(`taskType`, `
|
|
13
|
+
> **registerHandler**\<`T`, `U`\>(`taskType`, `module`, `method`, `stateChangeCallback`?): `Promise`\<`void`\>
|
|
14
14
|
|
|
15
15
|
Register a handler for a task.
|
|
16
16
|
|
|
@@ -26,9 +26,17 @@ Register a handler for a task.
|
|
|
26
26
|
|
|
27
27
|
The type of the task the handler can process.
|
|
28
28
|
|
|
29
|
-
• **
|
|
29
|
+
• **module**: `string`
|
|
30
30
|
|
|
31
|
-
The handler
|
|
31
|
+
The module the handler is in.
|
|
32
|
+
|
|
33
|
+
• **method**: `string`
|
|
34
|
+
|
|
35
|
+
The method in the module to execute.
|
|
36
|
+
|
|
37
|
+
• **stateChangeCallback?**
|
|
38
|
+
|
|
39
|
+
The callback to execute when the task state is updated.
|
|
32
40
|
|
|
33
41
|
#### Returns
|
|
34
42
|
|
package/package.json
CHANGED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Type Alias: BackgroundTaskHandler()\<T, U\>
|
|
2
|
-
|
|
3
|
-
> **BackgroundTaskHandler**\<`T`, `U`\>: (`payload`) => `Promise`\<`U`\>
|
|
4
|
-
|
|
5
|
-
Interface describing a task handler, exceptions thrown in the handler will be caught.
|
|
6
|
-
|
|
7
|
-
## Type Parameters
|
|
8
|
-
|
|
9
|
-
• **T** = `any`
|
|
10
|
-
|
|
11
|
-
• **U** = `any`
|
|
12
|
-
|
|
13
|
-
## Parameters
|
|
14
|
-
|
|
15
|
-
• **payload**: `T`
|
|
16
|
-
|
|
17
|
-
## Returns
|
|
18
|
-
|
|
19
|
-
`Promise`\<`U`\>
|