mscststs-EventBus

自用,eventbus库

Questo script non dovrebbe essere installato direttamente. È una libreria per altri script da includere con la chiave // @require https://update.greasyfork.org/scripts/373588/639557/mscststs-EventBus.js

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

Autore
mscststs
Versione
0.0.1.20181024134253
Creato il
24/10/2018
Aggiornato il
24/10/2018
Dimensione
1,44 KB
Licenza
Non disponibile

一个自用的 eventbus

    以事件监听方式进行 部署,所有功能均需运行在eve接口之上。
    eve接口暴露了三个方法,使用on方法可以绑定一个事件和回调函数,index参数用于确认回调函数的优先级,index越大,越优先,相同的以先绑定的优先
    使用off方法可以解绑一个事件,如果绑定时使用了index,则解绑时也需要使用index,否则无法匹配
    使用emit可以触发一个事件,在回调函数中返回false将会阻止 index 较小的参数的继续回调

    例如:回调函数a和b同时绑定了“foo”,事件,a index为10,b index 为11,若b返回false,则 a 不会被回调