New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fastweb/event

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fastweb/event

event

  • 2.0.0
  • latest
  • npm
  • Socket score

Version published
Maintainers
3
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 14 Dec 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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc