New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@redbuck/toast

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@redbuck/toast

drag to sort element

latest
Source
npmnpm
Version
0.0.6
Version published
Maintainers
1
Created
Source

零依赖toast服务

DEMO

DEMO

安装

npm i @redbuck/toast或者 yarn add @redbuck/toast

引入

html

  <link rel="stylesheet" href="./lib/toast.css">
  <script type="text/javascript" src="./lib/toast.js"></script>

模块

import Toast from '@reabuck/toast'
import '@reabuck/toast/lib/toast.css'

使用

一般用法
  const toast = Toast(ToastOption);

  // toast.d.ts
  type ToastOption = string | managerType

managerType:

属性类型默认值描述
messageString''文字
typeString'text'类型
durationNumber2000延时,0表示永不消失
maskBooleanfalse是否有背景浮层
mountToFunction() => body挂载点
classNameString''自定义根标签class

toast: ToastManager实例.可通过实例方法clear清除自身

别名
  Toast.success(option);
  Toast.loading(option);
  Toast.error(option);

别名即Toast({type: 'name'})的简写方式.

如Toast.success('message')等价于Toast({message: 'message', type: 'success'})

注,loading默认duration为0,不关闭,需要指定时间或手动关闭

methods
  • Toast.clearAll() 用于清除所有Toast
  • Toast.clear(seed) 清除指定toast,seed即toast编号,根元素的id即为'toast'+seed

Keywords

js

FAQs

Package last updated on 15 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts