observe5
TypeScript icon, indicating that this package has built-in type declarations

1.3.0 • Public • Published

Observe or emitter

setup

yarn add observe5 or pnpm add observe5

Example

import Observe5 from 'observe5'


const Observe = new Observe5<{eventName: DataType}>();


Observe.on('eventName',callback)


Observe.emit('eventName',data)


Observe.off('eventName')

Demo

import Observe5 from 'observe5'

// create Observe
const Observe = new Observe5<{test: string}>();

// watch eventName for test
Observe.on('test',(res)=>{
    console.log(res)
})

// it is true.
Observe.emit('test',"test")

// it is  error code.
Observe.emit('test',1)

Package Sidebar

Install

npm i observe5

Weekly Downloads

2

Version

1.3.0

License

ISC

Unpacked Size

164 kB

Total Files

7

Last publish

Collaborators

  • caine.luo