-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[add] VS Code debug configuration [optimize] add Yarn lock for CI cache [optimize] update Upstream packages
- Loading branch information
Showing
12 changed files
with
6,336 additions
and
52 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 |
---|---|---|
|
@@ -3,4 +3,4 @@ node_modules/ | |
docs/ | ||
dist/ | ||
.parcel-cache/ | ||
.vscode/ | ||
.vscode/settings.json |
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,18 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug Jest", | ||
"type": "node", | ||
"request": "launch", | ||
"port": 9229, | ||
"runtimeArgs": [ | ||
"--inspect-brk", | ||
"${workspaceRoot}/node_modules/jest/bin/jest.js", | ||
"--runInBand" | ||
], | ||
"console": "integratedTerminal", | ||
"internalConsoleOptions": "neverOpen" | ||
} | ||
] | ||
} |
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 |
---|---|---|
|
@@ -11,13 +11,13 @@ | |
|
||
## Installation | ||
|
||
```Shell | ||
```shell | ||
npm install web-utility | ||
``` | ||
|
||
`index.html` | ||
|
||
```HTML | ||
```html | ||
<head> | ||
<script src="https://polyfill.app/api/polyfill?features=regenerator-runtime,url,scroll-behavior,intersection-observer"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/text.min.js"></script> | ||
|
@@ -26,7 +26,7 @@ npm install web-utility | |
|
||
`tsconfig.json` | ||
|
||
```JSON | ||
```json | ||
{ | ||
"compilerOptions": { | ||
"module": "ES2021", | ||
|
@@ -53,15 +53,38 @@ npm install web-utility | |
|
||
5. [Work with Existed Classes](https://github.com/EasyWebApp/BootCell/blob/a41bbc1/source/Content/Carousel.tsx#L82-L99) | ||
|
||
### Function Cache | ||
|
||
```typescript | ||
import { cache } from 'web-utility'; | ||
|
||
const getToken = cache(async (cleaner, code) => { | ||
const { access_token, expires_in } = await ( | ||
await fetch(`https://example.com/access_token?code=${code}`) | ||
).json(); | ||
|
||
setTimeout(cleaner, expires_in * 1000); | ||
|
||
return access_token; | ||
}, 'Get Token'); | ||
|
||
Promise.all([getToken('xxx'), getToken('yyy')]).then(([first, second]) => | ||
console.assert( | ||
first === second, | ||
'Getting token for many times should return the same before deadline' | ||
) | ||
); | ||
``` | ||
|
||
### Message Channel | ||
|
||
`index.ts` | ||
|
||
```TypeScript | ||
```typescript | ||
import { createMessageServer } from 'web-utility'; | ||
|
||
createMessageServer({ | ||
preset: () => ({test: 1}) | ||
preset: () => ({ test: 1 }) | ||
}); | ||
``` | ||
|
||
|
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,6 +1,6 @@ | ||
{ | ||
"name": "web-utility", | ||
"version": "2.9.5", | ||
"version": "3.0.0", | ||
"license": "LGPL-3.0", | ||
"author": "[email protected]", | ||
"description": "Web front-end toolkit based on TypeScript", | ||
|
@@ -24,24 +24,24 @@ | |
"main": "dist/index.js", | ||
"module": "dist/index.esm.js", | ||
"dependencies": { | ||
"@swc/helpers": "^0.2.13", | ||
"@swc/helpers": "^0.3.2", | ||
"regenerator-runtime": "^0.13.9" | ||
}, | ||
"devDependencies": { | ||
"@parcel/packager-ts": "^2.0.1", | ||
"@parcel/transformer-typescript-types": "^2.0.1", | ||
"@peculiar/webcrypto": "^1.2.2", | ||
"@types/jest": "^27.0.2", | ||
"@types/node": "^14.17.33", | ||
"@parcel/packager-ts": "^2.2.1", | ||
"@parcel/transformer-typescript-types": "^2.2.1", | ||
"@peculiar/webcrypto": "^1.2.3", | ||
"@types/jest": "^27.4.0", | ||
"@types/node": "^14.18.9", | ||
"husky": "^7.0.4", | ||
"intersection-observer": "^0.12.0", | ||
"jest": "^27.3.1", | ||
"lint-staged": "^11.2.6", | ||
"jest": "^27.4.7", | ||
"lint-staged": "^12.3.1", | ||
"open-cli": "^7.0.1", | ||
"parcel": "^2.0.1", | ||
"prettier": "^2.4.1", | ||
"ts-jest": "^27.0.7", | ||
"typedoc": "^0.22.8", | ||
"parcel": "^2.2.1", | ||
"prettier": "^2.5.1", | ||
"ts-jest": "^27.1.3", | ||
"typedoc": "^0.22.11", | ||
"typedoc-plugin-mdn-links": "^1.0.4", | ||
"typescript": "~4.3.5" | ||
}, | ||
|
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
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
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,20 +1,21 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "ES5", | ||
"module": "ES6", | ||
"moduleResolution": "Node", | ||
"esModuleInterop": true, | ||
"downlevelIteration": true, | ||
"declaration": true, | ||
"lib": ["ES2019", "DOM", "DOM.Iterable"], | ||
"outDir": "dist/" | ||
}, | ||
"include": ["source/*.ts"], | ||
"typedocOptions": { | ||
"name": "Web utility", | ||
"excludeExternals": true, | ||
"excludePrivate": true, | ||
"readme": "./ReadMe.md", | ||
"out": "docs/" | ||
} | ||
} | ||
{ | ||
"compilerOptions": { | ||
"target": "ES5", | ||
"module": "ES6", | ||
"moduleResolution": "Node", | ||
"esModuleInterop": true, | ||
"downlevelIteration": true, | ||
"declaration": true, | ||
"lib": ["ES2019", "DOM", "DOM.Iterable"], | ||
"types": ["node", "jest"], | ||
"outDir": "dist/" | ||
}, | ||
"include": ["source/*.ts"], | ||
"typedocOptions": { | ||
"name": "Web utility", | ||
"excludeExternals": true, | ||
"excludePrivate": true, | ||
"readme": "./ReadMe.md", | ||
"out": "docs/" | ||
} | ||
} |
Oops, something went wrong.