Skip to content

Commit

Permalink
Ref 完善导出
Browse files Browse the repository at this point in the history
  • Loading branch information
E0SelmY4V committed Jan 16, 2023
1 parent 0d171f2 commit 3647b53
Show file tree
Hide file tree
Showing 10 changed files with 43 additions and 39 deletions.
7 changes: 7 additions & 0 deletions global.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/**
* 幻想私社异步过程类
* @version 1.01220.20
* @license GPL-3.0-or-later
* @link https://github.com/E0SelmY4V/scpo-proce
*/
declare const scpoProce: typeof import('.');
1 change: 1 addition & 0 deletions main.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ declare namespace scpoProce {
/**
* 幻想私社异步过程类
* @version 1.01220.20
* @license GPL-3.0-or-later
* @link https://github.com/E0SelmY4V/scpo-proce
*/
declare function scpoProce<P extends readonly any[], E extends readonly any[] = [any]>(doexpr: scpoProce.CbCur<P, E>, config?: scpoProce.Config): scpoProce.Proce<P, E>
Expand Down
3 changes: 1 addition & 2 deletions main.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/**
* 幻想私社异步过程类
* @version 1.01220.20
* @author E0SelmY4V
* @license GPL-3.0-or-later
* @link https://github.com/E0SelmY4V/scpo-proce
*/
Expand All @@ -10,7 +9,7 @@
var notModule = typeof exports === 'undefined', voidArray = [];
(pipe.notModule = notModule)
? window.scpoProce = pipe
: (module.exports = pipe.scpoProce = pipe['default'] = pipe);
: (module.exports = pipe);

function apply(f, t, p) {
switch (p.length) {
Expand Down
24 changes: 13 additions & 11 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,37 @@ The oldest browser it support is IE5.
git clone https://github.com/E0SelmY4V/scpo-proce.git
```

## Usage
## Import

- ### CommonJS

The CommonJS module, like Node.js, "require" like this:

```javascript
const { scpoProce } = require('scpo-proce');
// or
var scpoProce = require('scpo-proce')["default"];
const scpoProce = require('scpo-proce');
```

- ### ES6
- ### Typescript

```ts
import scpoProce = require('scpo-proce');
```

If you are using ES module, you can:
- ### ES Module

```javascript
import scpoProce from 'scpo-proce';
```

- ### HTML

For the HTML:

```html
<script src="scpo-proce/main.js"></script>
```

And then, you can use it through `window.scpoProce` or `scpoProce`.
```js
/// <reference path="scpo-proce/global.d.ts" />

console.log(scpoProce);
```

## Tips

Expand Down
20 changes: 20 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const tester = require('export-tester');

tester({
sign: "scpoProce",
pack: 'scpo-proce',
cfg: {
ts: {
cjsMod: true,
},
},
// req: [],
disp: {
stat: false,
path: false,
},
}, {
import() {
log(scpoProce);
}
})
2 changes: 1 addition & 1 deletion test/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { scpoProce } = require('..');
/// <reference path="../global.d.ts" />
const https = require('https');
const webReq = (url, callback) => https.get(url, res => {
const list = [];
Expand Down
2 changes: 0 additions & 2 deletions test/test1.ts

This file was deleted.

2 changes: 0 additions & 2 deletions test/test2.js

This file was deleted.

1 change: 0 additions & 1 deletion test/test4.html

This file was deleted.

20 changes: 0 additions & 20 deletions tsconfig.json

This file was deleted.

0 comments on commit 3647b53

Please sign in to comment.