https://github.com/ymzuiku/vanilla-message
Use Vanilla.js make Message
https://github.com/ymzuiku/vanilla-message
Last synced: about 2 months ago
JSON representation
Use Vanilla.js make Message
- Host: GitHub
- URL: https://github.com/ymzuiku/vanilla-message
- Owner: ymzuiku
- License: mit
- Created: 2019-10-26T14:28:28.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T13:01:50.000Z (over 2 years ago)
- Last Synced: 2025-03-07T11:11:21.917Z (about 2 months ago)
- Language: TypeScript
- Size: 1.18 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vanilla-message
> Size < 1kb
## Install
```sh
$ npm install --save vanilla-message
```## Use
```js
import Message from "vanilla-message";Message.error("hello");
Message.success("hello");
Message.info("hello", "Ok");
Message.info("hello", "Ok", "Cancel");Message("hello", {
ok: "确定",
cancel: "取消",
timeOut: 5000,
style: {
background: "#f55",
},
});
```## Await message closse
```ts
import Message from "vanilla-message";Message.error("hello");
Message.success("hello");
Message.info("hello", "Ok");
Message.info("hello", "Ok", "Cancel");async function handleMessage() {
const ok = await Message("hello", {
ok: "确定",
cancel: "取消",
timeOut: 5000,
style: {
background: "#f55",
},
});console.log("You click ok:", ok);
}
```