Skip to content

Commit 29bf130

Browse files
committed
Merge branch 'release/0.3.0' into released
2 parents c64d6aa + f50c549 commit 29bf130

File tree

150 files changed

+4411
-1787
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+4411
-1787
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
22
/es
33
/dist
4+
/temp
45
.rpt2_cache
6+
tsdoc-metadata.json
57
# dependencies
68
/node_modules
79
/.pnp

.npmignore

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,27 @@
1+
.DS_Store
2+
*.log*
3+
*.tsbuildinfo
4+
/temp
15
.rpt2_cache
2-
node_modules
6+
tsdoc-metadata.json
7+
# dependencies
8+
/node_modules
9+
/.pnp
10+
.pnp.js
11+
12+
# testing
13+
/coverage
14+
15+
# production
16+
/build
17+
18+
# misc
319
.DS_Store
20+
.env.local
21+
.env.development.local
22+
.env.test.local
23+
.env.production.local
24+
425
npm-debug.log*
526
yarn-debug.log*
627
yarn-error.log*
7-
*.tsbuildinfo

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
{
2-
"typescript.tsdk": "node_modules\\typescript\\lib"
2+
"typescript.tsdk": "node_modules\\typescript\\lib",
3+
"search.exclude": {
4+
"**/api-document": true
5+
}
36
}

.vscode/tasks.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
// 有关 tasks.json 格式的文档,请参见
3+
// https://go.microsoft.com/fwlink/?LinkId=733558
4+
"version": "2.0.0",
5+
"tasks": [
6+
{
7+
"type": "npm",
8+
"script": "start-tsc",
9+
"problemMatcher": [
10+
"$tsc-watch"
11+
],
12+
"isBackground": true
13+
}
14+
]
15+
}

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
# @holoflows/kit · ![GitHub license](https://img.shields.io/badge/license-AGPL-blue.svg?style=flat-square) [![npm version](https://img.shields.io/npm/v/@holoflows/kit.svg?style=flat-square)](https://www.npmjs.com/package/@holoflows/kit) ![Ciecle CI](https://img.shields.io/circleci/project/github/DimensionFoundation/holoflows-kit.svg?style=flat-square&logo=circleci)
1+
# @holoflows/kit · ![GitHub license](https://img.shields.io/badge/license-AGPL-blue.svg?style=flat-square) [![npm version](https://img.shields.io/npm/v/@holoflows/kit.svg?style=flat-square)](https://www.npmjs.com/package/@holoflows/kit) ![Ciecle CI](https://img.shields.io/circleci/project/github/DimensionDev/Holoflows-Kit.svg?style=flat-square&logo=circleci)
22

33
Toolkit for modern web browser extension developing.
44

55
## Documentation
66

7-
[English documentation](./doc/en/index.md)
7+
[Get Started](./doc/en/index.md)
88

9-
[简体中文文档](./doc/zh-CN/index.md)
9+
[初次使用](./doc/zh-CN/index.md)
10+
11+
[API Documentation](./api-documents/kit.md)
1012

1113
## License
1214

api-documents/kit.asynccall.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@holoflows/kit](./kit.md) &gt; [AsyncCall](./kit.asynccall.md)
4+
5+
## AsyncCall() function
6+
7+
Async call between different context.
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
export declare function AsyncCall<OtherSideImplementedFunctions = {}>(implementation: Default, options?: Partial<AsyncCallOptions>): OtherSideImplementedFunctions;
13+
```
14+
15+
## Parameters
16+
17+
| Parameter | Type | Description |
18+
| --- | --- | --- |
19+
| implementation | <code>Default</code> | Implementation of this side. |
20+
| options | <code>Partial&lt;AsyncCallOptions&gt;</code> | Define your own serializer, MessageCenter or other options. |
21+
22+
<b>Returns:</b>
23+
24+
`OtherSideImplementedFunctions`
25+
26+
## Remarks
27+
28+
Async call is a high level abstraction of MessageCenter.
29+
30+
\# Shared code
31+
32+
- How to stringify/parse parameters/returns should be shared, defaults to NoSerialization.
33+
34+
- `key` should be shared.
35+
36+
\# One side
37+
38+
- Should provide some functions then export its type (for example, `BackgroundCalls`<!-- -->)
39+
40+
- `const call = AsyncCall<ForegroundCalls>(backgroundCalls)`
41+
42+
- Then you can `call` any method on `ForegroundCalls`
43+
44+
\# Other side
45+
46+
- Should provide some functions then export its type (for example, `ForegroundCalls`<!-- -->)
47+
48+
- `const call = AsyncCall<BackgroundCalls>(foregroundCalls)`
49+
50+
- Then you can `call` any method on `BackgroundCalls`
51+
52+
Note: Two sides can implement the same function
53+
54+
## Example
55+
56+
For example, here is a mono repo.
57+
58+
Code for UI part:
59+
60+
```ts
61+
const UI = {
62+
async dialog(text: string) {
63+
alert(text)
64+
},
65+
}
66+
export type UI = typeof UI
67+
const callsClient = AsyncCall<Server>(UI)
68+
callsClient.sendMail('hello world', 'what')
69+
70+
```
71+
Code for server part
72+
73+
```ts
74+
const Server = {
75+
async sendMail(text: string, to: string) {
76+
return true
77+
}
78+
}
79+
export type Server = typeof Server
80+
const calls = AsyncCall<UI>(Server)
81+
calls.dialog('hello')
82+
83+
```
84+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@holoflows/kit](./kit.md) &gt; [AsyncCallOptions](./kit.asynccalloptions.md) &gt; [dontThrowOnNotImplemented](./kit.asynccalloptions.dontthrowonnotimplemented.md)
4+
5+
## AsyncCallOptions.dontThrowOnNotImplemented property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
dontThrowOnNotImplemented: boolean;
11+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@holoflows/kit](./kit.md) &gt; [AsyncCallOptions](./kit.asynccalloptions.md) &gt; [key](./kit.asynccalloptions.key.md)
4+
5+
## AsyncCallOptions.key property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
key: string;
11+
```

api-documents/kit.asynccalloptions.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@holoflows/kit](./kit.md) &gt; [AsyncCallOptions](./kit.asynccalloptions.md)
4+
5+
## AsyncCallOptions interface
6+
7+
Options for [AsyncCall()](./kit.asynccall.md)
8+
9+
<b>Signature:</b>
10+
11+
```typescript
12+
export interface AsyncCallOptions
13+
```
14+
15+
## Properties
16+
17+
| Property | Type | Description |
18+
| --- | --- | --- |
19+
| [dontThrowOnNotImplemented](./kit.asynccalloptions.dontthrowonnotimplemented.md) | <code>boolean</code> | |
20+
| [key](./kit.asynccalloptions.key.md) | <code>string</code> | |
21+
| [MessageCenter](./kit.asynccalloptions.messagecenter.md) | <code>{</code><br/><code> new (): {</code><br/><code> on(event: string, cb: (data: any) =&gt; void): void;</code><br/><code> send(event: string, data: any): void;</code><br/><code> };</code><br/><code> }</code> | |
22+
| [serializer](./kit.asynccalloptions.serializer.md) | <code>Serialization</code> | |
23+
| [writeToConsole](./kit.asynccalloptions.writetoconsole.md) | <code>boolean</code> | |
24+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
2+
3+
[Home](./index.md) &gt; [@holoflows/kit](./kit.md) &gt; [AsyncCallOptions](./kit.asynccalloptions.md) &gt; [MessageCenter](./kit.asynccalloptions.messagecenter.md)
4+
5+
## AsyncCallOptions.MessageCenter property
6+
7+
<b>Signature:</b>
8+
9+
```typescript
10+
MessageCenter: {
11+
new (): {
12+
on(event: string, cb: (data: any) => void): void;
13+
send(event: string, data: any): void;
14+
};
15+
};
16+
```

0 commit comments

Comments
 (0)