@litt1e-p/notification-center

0.0.5 • Public • Published

NotificationCenter

NotificationCenter for vue which is base on publish-subcribe pattern and Vue emitter

Installation

npm i @litt1e-p/notification-center --save

Usage

import { NotificationCenter } from '@litt1e-p/notification-center'

// 1. add observer
NotificationCenter.$addObserver('noticeName', cb)

// 2. post a message
NotificationCenter.$post('noticeName', someMessage)

// 3. remove an observer when destroy
NotificationCenter.$removeObserver('noticeName', cb)


function cb (msg) {
  console.info(msg)
}
/////

for more usage

Package Sidebar

Install

npm i @litt1e-p/notification-center

Weekly Downloads

1

Version

0.0.5

License

MIT

Unpacked Size

248 kB

Total Files

5

Last publish

Collaborators

  • litt1e-p