Added usage

This commit is contained in:
Ray 2026-07-08 11:01:06 +01:00
parent 6240a5ec17
commit 8640369340
2 changed files with 140 additions and 0 deletions

View File

@ -27,6 +27,10 @@ For example: you wanted to watch a random episode of your favourite show.
See [Releases](/Ray/bstoast4)
## Documentation
See [Usage](wiki/USAGE.md)
## Acknowledgements
This software uses a number of dependencies and assets from third-parties. These developers and artists deserve due credit for their work and for their commitment to sharing their work freely. Each product is released under their own particular license, for more information please visit their websites.

136
wiki/USAGE.md Normal file
View File

@ -0,0 +1,136 @@
# BSToast4
## Usage
This is the usage guide for **BSToast4**, version **0.2.0.059**.
---
## `Create(options)`
Creates a Toast on the page. The default position is the **top-right**.
### Options
```javascript
{
Icon: "",
Title: "",
Time: "",
Message: "",
Footer: "",
Animation: true,
AutoHide: true,
Delay: 6000,
Position: "position:fixed; top:0; right:80px; margin:20px;",
MinWidth: 320,
MinHeight: 100,
HeaderClass: "bg-light",
FooterClass: "bg-light text-center"
}
```
### Parameters
| Name | Type | Description |
|------|------|-------------|
| `Icon` | `html` | HTML for the top-left image. |
| `Title` | `string` | Label shown at the top of the toast. |
| `Time` | `string` | Text displayed at the top-right of the toast, typically the time. |
| `Message` | `string` | HTML body of the toast. |
| `Footer` | `string` | HTML body of the toast footer. |
| `Animation` | `bool` | Whether the toast opens with an animation. |
| `AutoHide` | `bool` | Whether the toast automatically closes after a delay. |
| `Delay` | `int` | Delay before automatically closing the toast, in milliseconds. |
| `Position` | `css` | CSS defining the toast container position. |
| `MinWidth` | `int` | Minimum width of the toast. |
| `MinHeight` | `int` | Minimum height of the toast. |
| `HeaderClass` | `css class` | CSS class applied to the toast header. |
| `FooterClass` | `css class` | CSS class applied to the toast footer. |
### Example
```javascript
BSToast4.Create({
Icon: "",
Title: "Hello Toast",
Time: "Now",
Message: "Hello",
Footer: "Footer",
Animation: true,
AutoHide: true,
Delay: 6000,
Position: "position:fixed; top:0; right:80px; margin:20px;",
MinWidth: 320,
MinHeight: 100,
HeaderClass: "bg-light",
FooterClass: "bg-light text-center"
});
```
---
## `Push(options)`
Creates a new toast or appends a toast to the existing toast stack.
### Options
```javascript
{
Icon: "",
Title: "",
Time: "",
Message: "",
Footer: "",
Animation: true,
AutoHide: true,
Delay: 6000,
MinWidth: 320,
MinHeight: 100
}
```
### Parameters
| Name | Type | Description |
|------|------|-------------|
| `Icon` | `html` | HTML for the top-left image. |
| `Title` | `string` | Label shown at the top of the toast. |
| `Time` | `string` | Text displayed at the top-right of the toast, typically the time. |
| `Message` | `string` | HTML body of the toast. |
| `Footer` | `string` | HTML body of the toast footer. |
| `Animation` | `bool` | Whether the toast opens with an animation. |
| `AutoHide` | `bool` | Whether the toast automatically closes after a delay. |
| `Delay` | `int` | Delay before automatically closing the toast, in milliseconds. |
| `MinWidth` | `int` | Minimum width of the toast. |
| `MinHeight` | `int` | Minimum height of the toast. |
### Example
```javascript
BSToast4.Create({
Icon: "",
Title: "Hello Toast (2)",
Time: "Now",
Message: "Hello again",
Footer: "",
Animation: true,
AutoHide: true,
Delay: 6000,
MinWidth: 320,
MinHeight: 100
});
```
---
## `Clear()`
Closes all toasts currently displayed on the page.
### Example
```javascript
BSToast4.Clear();
```