apeman-service-toast
v2.0.0
Published
Service for toasts.
Downloads
14
Readme
apeman-service-toast
Service for toasts.
Installation
$ npm install apeman-service-toast --save
Usage
#!/usr/bin/env node
'use strict'
const { ApToastService } = require('apeman-service-toast')
const { createStore } = require('redux')
const { reducer } = require('apeman-service-base')
const co = require('co')
co(function * () {
let store = createStore(reducer)
let service = new ApToastService(store)
}).catch((err) => console.error(err))
API
[email protected]
Service for toasts.
- Functions
- ApToastService Class
Functions
create(args) -> ApToastService
Create the service instance
| Param | Type | Description | | ----- | --- | -------- | | args | * | |
ApToastService Class
Service
new ApToastService(store, options)
Constructor of ApToastService class
| Param | Type | Description | | ----- | --- | -------- | | store | Object | Redux store | | options | Object | Optional settings |
service.getToasts(level) -> Array.<string>
Get toast
| Param | Type | Description | | ----- | --- | -------- | | level | string | Toast level |
service.toast(level, text) -> Promise
Show toast
| Param | Type | Description | | ----- | --- | -------- | | level | string | Toast level | | text | string | Toast text |
service.infoToast(text) -> Promise
Show info toast
| Param | Type | Description | | ----- | --- | -------- | | text | | |
service.warnToast(text) -> Promise
Show warn toast
| Param | Type | Description | | ----- | --- | -------- | | text | | |
service.errorToast(text) -> Promise
Show error toast
| Param | Type | Description | | ----- | --- | -------- | | text | | |
License
This software is released under the MIT License.