Skip to content

Commit 7ddf07c

Browse files
authored
docs: update package name and add MessageChannel mock (#524)
1 parent f360db8 commit 7ddf07c

File tree

2 files changed

+52
-17
lines changed

2 files changed

+52
-17
lines changed

README.md

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,28 @@
1-
# rc-dialog
1+
# @rc-component/dialog
22

3-
react dialog component
3+
react dialog component.
44

5-
[![NPM version][npm-image]][npm-url] [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square)](https://github.com/umijs/dumi) [![build status][github-actions-image]][github-actions-url] [![Test coverage][codecov-image]][codecov-url] [![npm download][download-image]][download-url] [![bundle size][bundlephobia-image]][bundlephobia-url]
5+
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url]
66

7-
[npm-image]: http://img.shields.io/npm/v/rc-dialog.svg?style=flat-square
8-
[npm-url]: http://npmjs.org/package/rc-dialog
9-
[github-actions-image]: https://github.com/react-component/dialog/workflows/CI/badge.svg
10-
[github-actions-url]: https://github.com/react-component/dialog/actions
11-
[circleci-image]: https://img.shields.io/circleci/react-component/dialog/master?style=flat-square
12-
[circleci-url]: https://circleci.com/gh/react-component/dialog
7+
[npm-image]: https://img.shields.io/npm/v/@rc-component/dialog.svg?style=flat-square
8+
[npm-url]: https://npmjs.org/package/@rc-component/dialog
9+
[travis-image]: https://img.shields.io/travis/react-component/dialog/master?style=flat-square
10+
[travis-url]: https://travis-ci.com/react-component/dialog
11+
[github-actions-image]: https://github.com/react-component/dialog/actions/workflows/ci.yml/badge.svg
12+
[github-actions-url]: https://github.com/react-component/dialog/actions/workflows/ci.yml
1313
[codecov-image]: https://img.shields.io/codecov/c/github/react-component/dialog/master.svg?style=flat-square
1414
[codecov-url]: https://app.codecov.io/gh/react-component/dialog
15-
[download-image]: https://img.shields.io/npm/dm/rc-dialog.svg?style=flat-square
16-
[download-url]: https://npmjs.org/package/rc-dialog
17-
[bundlephobia-url]: https://bundlephobia.com/result?p=rc-dialog
18-
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/rc-dialog
15+
[david-url]: https://david-dm.org/react-component/dialog
16+
[david-image]: https://david-dm.org/react-component/dialog/status.svg?style=flat-square
17+
[david-dev-url]: https://david-dm.org/react-component/dialog?type=dev
18+
[david-dev-image]: https://david-dm.org/react-component/dialog/dev-status.svg?style=flat-square
19+
[download-image]: https://img.shields.io/npm/dm/@rc-component/dialog.svg?style=flat-square
20+
[download-url]: https://npmjs.org/package/@rc-component/dialog
21+
[bundlephobia-url]: https://bundlephobia.com/package/@rc-component/dialog
22+
[bundlephobia-image]: https://badgen.net/bundlephobia/minzip/@rc-component/dialog
23+
[dumi-url]: https://github.com/umijs/dumi
24+
[dumi-image]: https://img.shields.io/badge/docs%20by-dumi-blue?style=flat-square
25+
1926

2027
## Screenshot
2128

@@ -29,12 +36,12 @@ online example: https://dialog.react-component.vercel.app/
2936

3037
## Install
3138

32-
[![rc-dialog](https://nodei.co/npm/rc-dialog.png)](https://npmjs.org/package/rc-dialog)
39+
[![@rc-component/dialog](https://nodei.co/npm/@rc-component/dialog.png)](https://npmjs.org/package/@rc-component/dialog)
3340

3441
## Usage
3542

3643
```js
37-
var Dialog = require('rc-dialog');
44+
var Dialog = require('@rc-component/dialog');
3845

3946
ReactDOM.render(
4047
<Dialog title={title} onClose={callback1} visible>
@@ -47,7 +54,7 @@ ReactDOM.render(
4754

4855
## API
4956

50-
### rc-dialog
57+
### @rc-component/dialog
5158

5259
| Name | Type | Default | Description | Version |
5360
| --- | --- | --- | --- | --- |
@@ -102,7 +109,7 @@ open coverage/ dir
102109

103110
## License
104111

105-
rc-dialog is released under the MIT license.
112+
@rc-component/dialog is released under the MIT license.
106113

107114

108115
## 🤝 Contributing

tests/setup.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,31 @@ console.error = (...args) => {
2424

2525
originError(...args);
2626
};
27+
28+
window.MessageChannel = class {
29+
port1;
30+
port2;
31+
constructor() {
32+
const createPort = () => {
33+
const port = {
34+
onmessage: null,
35+
postMessage: (message) => {
36+
setTimeout(() => {
37+
if (port._target && typeof port._target.onmessage === 'function') {
38+
port._target.onmessage({ data: message });
39+
}
40+
}, 0);
41+
},
42+
_target: null,
43+
};
44+
return port;
45+
};
46+
47+
const port1 = createPort();
48+
const port2 = createPort();
49+
port1._target = port2;
50+
port2._target = port1;
51+
this.port1 = port1;
52+
this.port2 = port2;
53+
}
54+
}

0 commit comments

Comments
 (0)