Code Monkey home page Code Monkey logo

saw-event's Introduction

Hi there 👋

Hello, my name is urain39!

I am a developer who like to writing programs in Python, JavaScript, and C-Like Languages :)

saw-event's People

Contributors

urain39 avatar

Watchers

 avatar  avatar  avatar

saw-event's Issues

特性:多事件同一处理

这个特性允许我们将一个回调绑定在多个事件上,如下:

SAWEvent.on([SAWEvents.DISCONNECTED, SAWEvent.SETTINGS_UPDATED], function () {
    // ...
});

bug:事件回调不应该并列执行

  1. 下一阶段的回调必须在当前阶段的回调都执行完毕后才能执行。
  2. 分发事件的回调(dispatch)的返回值必须是可以等待(await)的对象 。
SAWEvent.on(EV, function (data, dispatch) {
    dispatch(EV2);
    dispatch(EV3);
});

特性:阻止事件继续传播

callback可以选择性的返回一个boolean类型,表示是否继续往下传播。

如:

SAWEvent.on('INITIALIZED', true, function() {
    return false; // 阻止事件传播
});

返回类型应该是boolean | undefined

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.