Socket
Book a DemoInstallSign in
Socket

@fastweb/event_common

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastweb/event_common

event

1.1.0
latest
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

自定义事件绑定 Build Status npm

所谓自定义事件,就是有别于有别于带有浏览器特定行为的事件(类似click, mouseover, submit, keydown等事件),事件名称可以随意定义,可以通过特定的方法进行添加,触发以及删除

安装

ems:

cnpm i @fastweb/event -S

commonJs:

cnpm i @fastweb/event_common -S

例子

import Event from '@fastweb/event';
class MyClass extends Event{
  ...
  init(){
    //触发事件
    this.emit("init",params)
  }
}
//绑定事件
MyClass.on('init',function(){
  ...
})
//绑定一次事件
MyClass.one('init',function(){
  ...
})
//删除事件
MyClass.off('init',function(){
  ...
})

FAQs

Package last updated on 21 Nov 2017

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

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.