-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'release/0.3.0' into released
- Loading branch information
Showing
150 changed files
with
4,411 additions
and
1,787 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,27 @@ | ||
.DS_Store | ||
*.log* | ||
*.tsbuildinfo | ||
/temp | ||
.rpt2_cache | ||
node_modules | ||
tsdoc-metadata.json | ||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
|
||
# testing | ||
/coverage | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
.env.local | ||
.env.development.local | ||
.env.test.local | ||
.env.production.local | ||
|
||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
*.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
{ | ||
"typescript.tsdk": "node_modules\\typescript\\lib" | ||
"typescript.tsdk": "node_modules\\typescript\\lib", | ||
"search.exclude": { | ||
"**/api-document": true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
// 有关 tasks.json 格式的文档,请参见 | ||
// https://go.microsoft.com/fwlink/?LinkId=733558 | ||
"version": "2.0.0", | ||
"tasks": [ | ||
{ | ||
"type": "npm", | ||
"script": "start-tsc", | ||
"problemMatcher": [ | ||
"$tsc-watch" | ||
], | ||
"isBackground": true | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AsyncCall](./kit.asynccall.md) | ||
|
||
## AsyncCall() function | ||
|
||
Async call between different context. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare function AsyncCall<OtherSideImplementedFunctions = {}>(implementation: Default, options?: Partial<AsyncCallOptions>): OtherSideImplementedFunctions; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| implementation | <code>Default</code> | Implementation of this side. | | ||
| options | <code>Partial<AsyncCallOptions></code> | Define your own serializer, MessageCenter or other options. | | ||
|
||
<b>Returns:</b> | ||
|
||
`OtherSideImplementedFunctions` | ||
|
||
## Remarks | ||
|
||
Async call is a high level abstraction of MessageCenter. | ||
|
||
\# Shared code | ||
|
||
- How to stringify/parse parameters/returns should be shared, defaults to NoSerialization. | ||
|
||
- `key` should be shared. | ||
|
||
\# One side | ||
|
||
- Should provide some functions then export its type (for example, `BackgroundCalls`<!-- -->) | ||
|
||
- `const call = AsyncCall<ForegroundCalls>(backgroundCalls)` | ||
|
||
- Then you can `call` any method on `ForegroundCalls` | ||
|
||
\# Other side | ||
|
||
- Should provide some functions then export its type (for example, `ForegroundCalls`<!-- -->) | ||
|
||
- `const call = AsyncCall<BackgroundCalls>(foregroundCalls)` | ||
|
||
- Then you can `call` any method on `BackgroundCalls` | ||
|
||
Note: Two sides can implement the same function | ||
|
||
## Example | ||
|
||
For example, here is a mono repo. | ||
|
||
Code for UI part: | ||
|
||
```ts | ||
const UI = { | ||
async dialog(text: string) { | ||
alert(text) | ||
}, | ||
} | ||
export type UI = typeof UI | ||
const callsClient = AsyncCall<Server>(UI) | ||
callsClient.sendMail('hello world', 'what') | ||
|
||
``` | ||
Code for server part | ||
|
||
```ts | ||
const Server = { | ||
async sendMail(text: string, to: string) { | ||
return true | ||
} | ||
} | ||
export type Server = typeof Server | ||
const calls = AsyncCall<UI>(Server) | ||
calls.dialog('hello') | ||
|
||
``` | ||
|
11 changes: 11 additions & 0 deletions
11
api-documents/kit.asynccalloptions.dontthrowonnotimplemented.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AsyncCallOptions](./kit.asynccalloptions.md) > [dontThrowOnNotImplemented](./kit.asynccalloptions.dontthrowonnotimplemented.md) | ||
|
||
## AsyncCallOptions.dontThrowOnNotImplemented property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
dontThrowOnNotImplemented: boolean; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AsyncCallOptions](./kit.asynccalloptions.md) > [key](./kit.asynccalloptions.key.md) | ||
|
||
## AsyncCallOptions.key property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
key: string; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AsyncCallOptions](./kit.asynccalloptions.md) | ||
|
||
## AsyncCallOptions interface | ||
|
||
Options for [AsyncCall()](./kit.asynccall.md) | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface AsyncCallOptions | ||
``` | ||
|
||
## Properties | ||
|
||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [dontThrowOnNotImplemented](./kit.asynccalloptions.dontthrowonnotimplemented.md) | <code>boolean</code> | | | ||
| [key](./kit.asynccalloptions.key.md) | <code>string</code> | | | ||
| [MessageCenter](./kit.asynccalloptions.messagecenter.md) | <code>{</code><br/><code> new (): {</code><br/><code> on(event: string, cb: (data: any) => void): void;</code><br/><code> send(event: string, data: any): void;</code><br/><code> };</code><br/><code> }</code> | | | ||
| [serializer](./kit.asynccalloptions.serializer.md) | <code>Serialization</code> | | | ||
| [writeToConsole](./kit.asynccalloptions.writetoconsole.md) | <code>boolean</code> | | | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AsyncCallOptions](./kit.asynccalloptions.md) > [MessageCenter](./kit.asynccalloptions.messagecenter.md) | ||
|
||
## AsyncCallOptions.MessageCenter property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
MessageCenter: { | ||
new (): { | ||
on(event: string, cb: (data: any) => void): void; | ||
send(event: string, data: any): void; | ||
}; | ||
}; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AsyncCallOptions](./kit.asynccalloptions.md) > [serializer](./kit.asynccalloptions.serializer.md) | ||
|
||
## AsyncCallOptions.serializer property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
serializer: Serialization; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AsyncCallOptions](./kit.asynccalloptions.md) > [writeToConsole](./kit.asynccalloptions.writetoconsole.md) | ||
|
||
## AsyncCallOptions.writeToConsole property | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
writeToConsole: boolean; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AutomatedTabTask](./kit.automatedtabtask.md) | ||
|
||
## AutomatedTabTask() function | ||
|
||
Open a new page in the background, execute some task, then close it automatically. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export declare function AutomatedTabTask<T extends Record<string, (...args: any[]) => Promise<any>>>(taskImplements: T, options?: Partial<AutomatedTabTaskDefineTimeOptions>): ((url: string, options?: Partial<AutomatedTabTaskRuntimeOptions>) => T) | null; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| taskImplements | <code>T</code> | All tasks that background page can call. | | ||
| options | <code>Partial<AutomatedTabTaskDefineTimeOptions></code> | Options | | ||
|
||
<b>Returns:</b> | ||
|
||
`((url: string, options?: Partial<AutomatedTabTaskRuntimeOptions>) => T) | null` | ||
|
||
## Example | ||
|
||
In content script: (You must run this in the page you wanted to run task in!) | ||
|
||
```ts | ||
export const task = AutomatedTabTask({ | ||
async taskA() { | ||
return 'Done!' | ||
}, | ||
}) | ||
|
||
``` | ||
In background script: | ||
|
||
Open https://example.com/ then run taskA() on that page, which will return 'Done!' | ||
|
||
```ts | ||
import { task } from '...' | ||
task('https://example.com/').taskA() | ||
|
||
``` | ||
|
13 changes: 13 additions & 0 deletions
13
api-documents/kit.automatedtabtaskdefinetimeoptions.concurrent.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AutomatedTabTaskDefineTimeOptions](./kit.automatedtabtaskdefinetimeoptions.md) > [concurrent](./kit.automatedtabtaskdefinetimeoptions.concurrent.md) | ||
|
||
## AutomatedTabTaskDefineTimeOptions.concurrent property | ||
|
||
At most run `concurrent` tasks. Prevents open too many tabs at the same time. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
concurrent: number; | ||
``` |
13 changes: 13 additions & 0 deletions
13
api-documents/kit.automatedtabtaskdefinetimeoptions.key.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AutomatedTabTaskDefineTimeOptions](./kit.automatedtabtaskdefinetimeoptions.md) > [key](./kit.automatedtabtaskdefinetimeoptions.key.md) | ||
|
||
## AutomatedTabTaskDefineTimeOptions.key property | ||
|
||
A unique key | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
key: string; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AutomatedTabTaskDefineTimeOptions](./kit.automatedtabtaskdefinetimeoptions.md) | ||
|
||
## AutomatedTabTaskDefineTimeOptions interface | ||
|
||
Define-time options for [AutomatedTabTask()](./kit.automatedtabtask.md) | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
export interface AutomatedTabTaskDefineTimeOptions extends AutomatedTabTaskSharedOptions | ||
``` | ||
## Properties | ||
| Property | Type | Description | | ||
| --- | --- | --- | | ||
| [concurrent](./kit.automatedtabtaskdefinetimeoptions.concurrent.md) | <code>number</code> | At most run <code>concurrent</code> tasks. Prevents open too many tabs at the same time. | | ||
| [key](./kit.automatedtabtaskdefinetimeoptions.key.md) | <code>string</code> | A unique key | | ||
| [memorizeTTL](./kit.automatedtabtaskdefinetimeoptions.memorizettl.md) | <code>number</code> | TTL for memorize | | ||
13 changes: 13 additions & 0 deletions
13
api-documents/kit.automatedtabtaskdefinetimeoptions.memorizettl.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AutomatedTabTaskDefineTimeOptions](./kit.automatedtabtaskdefinetimeoptions.md) > [memorizeTTL](./kit.automatedtabtaskdefinetimeoptions.memorizettl.md) | ||
|
||
## AutomatedTabTaskDefineTimeOptions.memorizeTTL property | ||
|
||
TTL for memorize | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
memorizeTTL: number; | ||
``` |
13 changes: 13 additions & 0 deletions
13
api-documents/kit.automatedtabtaskruntimeoptions.important.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [@holoflows/kit](./kit.md) > [AutomatedTabTaskRuntimeOptions](./kit.automatedtabtaskruntimeoptions.md) > [important](./kit.automatedtabtaskruntimeoptions.important.md) | ||
|
||
## AutomatedTabTaskRuntimeOptions.important property | ||
|
||
This task is important, need to start now without queue. | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
important: boolean; | ||
``` |
Oops, something went wrong.