npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

popular-message

v1.2.0

Published

轻量级的信息反馈组件,在顶部居中显示,并自动消失。有多种不同的提示状态可选择。

Downloads

218

Readme

中文 | English

popular-message

travis-ci Coverage Status license release

A lightweight feedback message appearing at the top of the screen, fading automatically. Has many different options for different situations.

Demo

Features

  1. API design for iview-$mesage。
  2. No dependence,lightweight,200 lines of source code,Smaller after compression。
  3. UI Beautiful,Reference iview UI styles。

Install

  1. use unpkg cdn link
<script src="https://unpkg.com/popular-message/index.js"></script>
<link rel="stylesheet" href="https://unpkg.com/popular-message/index.css">

2.use npm or yarn install

$ npm install popular-message
$ yarn add popular-message

Use

use script,get global variable $message

use npm install,need import The module

import $message from 'popular-message';
import 'popular-message/index.css';

use in page

<!-- global configuration -->
$message.config({ top:85, duration: 4})

<!-- types -->
$message.info('this is a info message')
$message.success('this is a success message')
$message.warning('this is a info warning message')
$message.error('this is a info error message')
$message.loading('loading...')

<!-- onClose -->
$message.info('this is message can close', {
    onClose:() => console.log('close'),
    closable: true,
    duration: 6
})

<!-- destroy -->
$message.destroy()

API

Message instance

This component can be used with the following static methods:

  • $message.info(config)
  • $message.success(config)
  • $message.warning(config)
  • $message.error(config)
  • $message.loading(config)

Parameter config can be string or object. When string, the content will be directly displayed, when object, the detail usage is explained below:

| Property | Description | Type| Default| |--- |--- |--- | --- | | duration | Time before prompt dismisses, in seconds. Use 0 to not dismiss |Number | 2| | onClose | Function to be called after the prompt is closed |Function | -| | closable | Whether to show a close button. |Boolean | false| | dangerUseHtml | whether message is treated as HTML string |Boolean | false|

Methods for global configuration and disposal are also provided:

  • $message.config(options)
  • $message.destroy()
$Message.config({
    top: 50,
    duration: 3
});

| Property | Description | Type| Default | |--- |--- |--- | --- | | top | Prompt's distance from top, in pixels. |Number | 24| | duration | Default time before prompt dismisses, in seconds. |Number | 1.5| | singleton | Singleton Pattern |Boolean | false|

License

Licensed under the MIT License.