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

notice-message

v1.1.1

Published

系统消息的通知/提醒的组件

Downloads

17

Readme

notice-message

Components for notifications/alerts for system messages

系统消息的通知/提醒的组件

🌰 Demo 示例

https://chenchengbi.github.io/notice-message/

📦 Install 安装

$ npm i notice-message

🔨 Usage 使用

import { Notice } from "notice-message";

/* When something happens that the user needs to know about, notify the user by calling the method as follows. */

Notice.message({ message: "I am a pop-up message" });

🔠 Details 详细用法

/**
 * Pop up a message
 * 弹出一条消息
 */
Notice.message({
  /**
   * Text content of the message
   * 需要显示的消息文字内容
   */
  message: 'I am a message',
  /**
   * Type of message, including: default, success, warning, error.
   * 消息的类型,包括:默认,成功,警告,错误
   */
  type: 'default',
  /**
   * The duration of the message in milliseconds. If set to 0 the message will not be closed automatically. The default value is 3000
   * 消息的显示时间,毫秒。设为 0 则不会自动关闭。默认为 3000
   */
  duration: 10000,
  /**
   * The container in which the message is embedded. The default is window.document.body. If you specify a container other than window.document.body, set the container's style yourself: set the position to one of relative/absolute/fixed and the overflow to one of hidden/auto.
   * 消息体嵌入在哪个容器。默认为 window.document.body。若指定 body 以外的容器,请自行设置容器的样式 position 为 relative/absolute/fixed 并且设置 overflow 为 hidden/auto
   */
  container: window.document.body,
  /**
   * The height dimension of the message box, in pixels. The default value is 48
   * 消息框的高度尺寸,像素。默认为 48
   */
  height: 64,
  /**
   * The font size of the message in pixels. The default value is 16
   * 消息的字体大小,像素。默认为 16
   */
  fontSize: 20,
  /**
   * Whether the position of the message is center or left or right, the default is 'center'.
   * 消息的位置是居中还是靠左或靠右,默认为居中即 'center'
   */
  align: 'center',
  /**
   * Whether or not the message's close button is displayed. Defaults to false
   * 消息的关闭按钮是否显示。默认为 false
   */
  closable: true,
  /**
   * The custom class name of the message
   * 消息的自定义类名
   */
  customClass: 'my-notice-message',
  /**
   * Callback function when the message is closed
   * 消息关闭时的回调函数
   */
  onClose: (message) => {
    console.log('message :>> ', message);
  }
});