jvent

WebJar for jvent

Лицензия

Лицензия

MIT
Категории

Категории

Github Инструменты разработки Контроль версий GUI Взаимодействие с пользователем
Группа

Группа

org.webjars.bower
Идентификатор

Идентификатор

github-com-pazguille-jvent
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

jvent
WebJar for jvent
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/pazguille/jvent

Скачать github-com-pazguille-jvent

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.bower/github-com-pazguille-jvent/ -->
<dependency>
    <groupId>org.webjars.bower</groupId>
    <artifactId>github-com-pazguille-jvent</artifactId>
    <version>1.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bower/github-com-pazguille-jvent/
implementation 'org.webjars.bower:github-com-pazguille-jvent:1.0.0'
// https://jarcasting.com/artifacts/org.webjars.bower/github-com-pazguille-jvent/
implementation ("org.webjars.bower:github-com-pazguille-jvent:1.0.0")
'org.webjars.bower:github-com-pazguille-jvent:jar:1.0.0'
<dependency org="org.webjars.bower" name="github-com-pazguille-jvent" rev="1.0.0">
  <artifact name="github-com-pazguille-jvent" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bower', module='github-com-pazguille-jvent', version='1.0.0')
)
libraryDependencies += "org.webjars.bower" % "github-com-pazguille-jvent" % "1.0.0"
[org.webjars.bower/github-com-pazguille-jvent "1.0.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

jvent.js

An universal JavaScript Emitter based on NodeJS EventEmitter.

NPM version License Build status Coverage Status Dependency status devDependency status downloads

Installation

$ npm install jvent

$ bower install jvent

Standalone

Also, you can use the standalone version without components.

<script src="../dist/jvent.js"></script>

How-to

First, requires Jvent:

var Jvent = require('jvent');

Creates a new instance:

var emitter = new Jvent();

Now, defines a listener:

function listener(arg1, arg2) {
    alert(arg1 + ' '+ arg2);
})

Then, adds a new event live with a listener:

emitter.on('live', listener);

Emitsthe event with some data:

emitter.emit('live', 'param1', 'param2');

API

Jvent#on(event, listener)

Adds a listener to the collection for a specified event.

  • event - The name of the event you want to add.
  • listener - Listener you want to add from given event.
emitter.on('live', listener);

Jvent#once(event, listener)

Adds a one time listener to the collection for a specified event. It will execute only once.

  • event - The name of the event.
  • listener - Listener you want to add from the given event.
emitter.once('live', listener);

Jvent#off(event, listener)

Removes a listener from the collection for a specified event.

  • event - The name of the event.
  • listener - Listener you want to remove from the given event.
emitter.off('live', listener);

Jvent#removeAllListeners(event)

Removes all listeners from the collection for a specified event.

  • event - The name of the event you want to remove.
emitter.removeAllListeners('live');

Jvent#listeners(event)

Returns all listeners from the collection for a specified event.

  • event - The name of the event.
emitter.listeners('live');

Jvent#emit(event, [arg1], [arg2], [...])

Execute each of the listeners collection in order with the given parameters. All emitters emit the event newListener when new listeners are added.

  • event - The name of the event you want to emit.
emitter.emit('live', 'data1', 'data2');

With ❤️ by

License

MIT license. Copyright © 2016 @pazguille.

Версии библиотеки

Версия
1.0.0