![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
seng-event
Advanced tools
Provides Classes and utilities for dispatching and listening to events.
Provides an EventDispatcher base class that adds the ability to dispatch events and attach handlers that should be called when such events are triggered. New event classes can be created by extending the AbstractEvent class provided in this module. This module also provides basic event classes BasicEvent and CommonEvent that are ready to be used with EventDispatcher.
seng-event also supports event capturing and bubbling phases, heavily inspired by existing event dispatching systems like the functionality described in the DOM Event W3 spec
npm i -S seng-event
We also have browser, amd, commonjs, umd, systemjs and es6 versions of this module available attached to the Github Releases.
import EventDispatcher, {AbstractEvent} from 'seng-event';
import {generateEventTypes, EVENT_TYPE_PLACEHOLDER} from 'seng-event/lib/util/eventTypeUtils';
// extend EventDispatcher
class Foo extends EventDispatcher {
...
}
// Create your own event class
class FooEvent extends AbstractEvent {
...
public static COMPLETE:string = EVENT_TYPE_PLACEHOLDER;
...
}
generateEventTypes({FooEvent});
// listener for events
const foo = new Foo();
const exampleHandler = (event:FooEvent) =>
{
console.log('Handler called!', event.type, event.target);
}
foo.addEventListener(FooEvent.COMPLETE, exampleHandler);
// dispatch an event (will execute exampleHandler and log 'Handler called!')
foo.dispatchEvent(new FooEvent(FooEvent.COMPLETE));
View the generated documentation.
In order to build seng-event, ensure that you have Git and Node.js installed.
Clone a copy of the repo:
git clone https://github.com/mediamonks/seng-event.git
Change to the seng-event directory:
cd seng-event
Install dev dependencies:
npm install
Use one of the following main scripts:
npm run build # build this project
npm run generate # generate all artifacts (compiles ts, webpack, docs and coverage)
npm run typings # install .d.ts dependencies (done on install)
npm run test-unit # run the unit tests
npm run validate # runs validation scripts, including test, lint and coverage check
npm run lint # run tslint on this project
npm run doc # generate typedoc and yuidoc documentation
npm run typescript-npm # just compile the typescript output used in the npm module
When installing this module, it adds a pre-commit hook, that runs the validate
script before committing, so you can be sure that everything checks out.
View CONTRIBUTING.md
View AUTHORS.md
MIT © MediaMonks
FAQs
Provides Classes and utilities for dispatching and listening to events.
The npm package seng-event receives a total of 1,148 weekly downloads. As such, seng-event popularity was classified as popular.
We found that seng-event demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.