henrikjoreteg / wildemitter Goto Github PK
View Code? Open in Web Editor NEWA super lightweight EventEmitter similar to what comes in Node.js, but with a support for wildcard events '*'
License: MIT License
A super lightweight EventEmitter similar to what comes in Node.js, but with a support for wildcard events '*'
License: MIT License
Can we add bower support to this library? Thanks
i'm getting a
TypeError: this.callbacks is undefined
error in recent simplewebrtc builds when using firefox.
This seems to come from https://github.com/HenrikJoreteg/wildemitter/blob/master/wildemitter.js#L98
but that looks ok?
Unfortunately, when trying to debug this, Firefox crashes.
Currently, this library doesn't work well with AMD pattern, and it needs a wrapper to be able to run with RequireJS.
Bower's official spec says that including a version
field in the bower.json
file is no longer supported. Instead, version information is supposed to come only from Git tags.
The version number in the file right now is wrong, which causes the following error when installing WildEmitter from Bower:
mismatch Version declared in the json (1.1.0) is different than the resolved one (1.2.0)
Instead of updating it to the proper version number, it should just be removed.
This code at wildemitter.js#L131 unintentionally matches all wildcard events that have been registered:
split = item.split('*');
if (item === '*' || (split.length === 2 && eventName.slice(0, split[1].length) === split[1])) {
result = result.concat(this.callbacks[item]);
}
The reason: split[1] is the empty part of the string after the '*' so we're comparing a 0 length slice of eventName ("") to split1.
Simply changing to
split = item.split('*');
if (item === '*' || (split.length === 2 && eventName.slice(0, split[0].length) === split[0])) {
result = result.concat(this.callbacks[item]);
}
will solve the problem because now we're comparing the eventName to the part of the wildcard before the asterisk.
Hi, could you please add an appropriate license to this library? I'm hoping for MIT. Unfortunately this has been flagged by our company's legal compliance tools due to unknown license.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.