mirror of
https://github.com/EddyVerbruggen/Toast-PhoneGap-Plugin.git
synced 2025-02-24 10:12:53 +08:00
#35 Close toast when app is suspended or closed: documentation
This commit is contained in:
parent
5eb202fd54
commit
9c269fc9ba
17
README.md
17
README.md
@ -118,16 +118,18 @@ Toast works with PhoneGap build too, but only with PhoneGap 3.0 and up.
|
||||
|
||||
Just add the following xml to your `config.xml` to always use the latest version of this plugin:
|
||||
```xml
|
||||
<gap:plugin name="nl.x-services.plugins.toast" />
|
||||
<gap:plugin name="nl.x-services.plugins.toast" source="plugins.cordova.io" />
|
||||
```
|
||||
or to use this exact version:
|
||||
or to use a specific version:
|
||||
```xml
|
||||
<gap:plugin name="nl.x-services.plugins.toast" version="1.0" />
|
||||
<gap:plugin name="nl.x-services.plugins.toast" source="plugins.cordova.io" version="2.0.6" />
|
||||
```
|
||||
|
||||
Toast.js is brought in automatically. There is no need to change or add anything in your html.
|
||||
|
||||
## 4. Usage
|
||||
|
||||
### Showing a Toast
|
||||
You have two choices to make when showing a Toast: where to show it and for how long.
|
||||
* show(message, duration, position)
|
||||
* duration: 'short', 'long'
|
||||
@ -148,6 +150,15 @@ You can copy-paste these lines of code for a quick test:
|
||||
<button onclick="window.plugins.toast.show('Hello there!', 'long', 'center', function(a){console.log('toast success: ' + a)}, function(b){alert('toast error: ' + b)})">Toast show long center</button>
|
||||
```
|
||||
|
||||
### Hiding a Toast
|
||||
In case you want to hide a Toast manually, call this:
|
||||
```js
|
||||
function hide() {
|
||||
// this function takes an optional success callback, but you can do without just as well
|
||||
window.plugins.toast.hide();
|
||||
}
|
||||
```
|
||||
|
||||
### WP8 quircks
|
||||
The WP8 implementation needs a little more work, but it's perfectly useable when you keep this in mind:
|
||||
* You can't show two Toasts simultaneously.
|
||||
|
Loading…
Reference in New Issue
Block a user