Beta 7 with some repo names changed.
This commit is contained in:
1 parent
0f7b40cca7
commit
963c19493a
3408 files changed
+462217
-15516
No files matched your search
+23
@@ -0,0 +1,23 @@
|
||||
var
|
||||
/**
|
||||
* Dependencies.
|
||||
*/
|
||||
gulp = require('gulp'),
|
||||
jscs = require('gulp-jscs'),
|
||||
jshint = require('gulp-jshint'),
|
||||
stylish = require('gulp-jscs-stylish');
|
||||
|
||||
|
||||
gulp.task('lint', function () {
|
||||
var src = ['gulpfile.js', 'index.js', 'lib/**/*.js'];
|
||||
|
||||
return gulp.src(src)
|
||||
.pipe(jshint('.jshintrc')) // Enforce good practics.
|
||||
.pipe(jscs('.jscsrc')) // Enforce style guide.
|
||||
.pipe(stylish.combineWithHintResults())
|
||||
.pipe(jshint.reporter('jshint-stylish', {verbose: true}))
|
||||
.pipe(jshint.reporter('fail'));
|
||||
});
|
||||
|
||||
|
||||
gulp.task('default', gulp.task('lint'));
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
module.exports = {
|
||||
EventTarget : require('./lib/EventTarget'),
|
||||
Event : require('./lib/Event')
|
||||
};
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* In browsers export the native Event interface.
|
||||
*/
|
||||
|
||||
module.exports = global.Event;
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Expose the Event class.
|
||||
*/
|
||||
module.exports = _Event;
|
||||
|
||||
|
||||
function _Event(type) {
|
||||
this.type = type;
|
||||
this.isTrusted = false;
|
||||
|
||||
// Set a flag indicating this is not a DOM Event object
|
||||
this._yaeti = true;
|
||||
}
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
/**
|
||||
* Expose the _EventTarget class.
|
||||
*/
|
||||
module.exports = _EventTarget;
|
||||
|
||||
function _EventTarget() {
|
||||
// Do nothing if called for a native EventTarget object..
|
||||
if (typeof this.addEventListener === 'function') {
|
||||
return;
|
||||
}
|
||||
|
||||
this._listeners = {};
|
||||
|
||||
this.addEventListener = _addEventListener;
|
||||
this.removeEventListener = _removeEventListener;
|
||||
this.dispatchEvent = _dispatchEvent;
|
||||
}
|
||||
|
||||
Object.defineProperties(_EventTarget.prototype, {
|
||||
listeners: {
|
||||
get: function () {
|
||||
return this._listeners;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
function _addEventListener(type, newListener) {
|
||||
var
|
||||
listenersType,
|
||||
i, listener;
|
||||
|
||||
if (!type || !newListener) {
|
||||
return;
|
||||
}
|
||||
|
||||
listenersType = this._listeners[type];
|
||||
if (listenersType === undefined) {
|
||||
this._listeners[type] = listenersType = [];
|
||||
}
|
||||
|
||||
for (i = 0; !!(listener = listenersType[i]); i++) {
|
||||
if (listener === newListener) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
listenersType.push(newListener);
|
||||
}
|
||||
|
||||
function _removeEventListener(type, oldListener) {
|
||||
var
|
||||
listenersType,
|
||||
i, listener;
|
||||
|
||||
if (!type || !oldListener) {
|
||||
return;
|
||||
}
|
||||
|
||||
listenersType = this._listeners[type];
|
||||
if (listenersType === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; !!(listener = listenersType[i]); i++) {
|
||||
if (listener === oldListener) {
|
||||
listenersType.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (listenersType.length === 0) {
|
||||
delete this._listeners[type];
|
||||
}
|
||||
}
|
||||
|
||||
function _dispatchEvent(event) {
|
||||
var
|
||||
type,
|
||||
listenersType,
|
||||
dummyListener,
|
||||
stopImmediatePropagation = false,
|
||||
i, listener;
|
||||
|
||||
if (!event || typeof event.type !== 'string') {
|
||||
throw new Error('`event` must have a valid `type` property');
|
||||
}
|
||||
|
||||
// Do some stuff to emulate DOM Event behavior (just if this is not a
|
||||
// DOM Event object)
|
||||
if (event._yaeti) {
|
||||
event.target = this;
|
||||
event.cancelable = true;
|
||||
}
|
||||
|
||||
// Attempt to override the stopImmediatePropagation() method
|
||||
try {
|
||||
event.stopImmediatePropagation = function () {
|
||||
stopImmediatePropagation = true;
|
||||
};
|
||||
} catch (error) {}
|
||||
|
||||
type = event.type;
|
||||
listenersType = (this._listeners[type] || []);
|
||||
|
||||
dummyListener = this['on' + type];
|
||||
if (typeof dummyListener === 'function') {
|
||||
dummyListener.call(this, event);
|
||||
}
|
||||
|
||||
for (i = 0; !!(listener = listenersType[i]); i++) {
|
||||
if (stopImmediatePropagation) {
|
||||
break;
|
||||
}
|
||||
|
||||
listener.call(this, event);
|
||||
}
|
||||
|
||||
return !event.defaultPrevented;
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
{
|
||||
"_from": "yaeti@^0.0.6",
|
||||
"_id": "yaeti@0.0.6",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-8m9ITXJoTPQr7ft2lwqhYI+/lXc=",
|
||||
"_location": "/yaeti",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "yaeti@^0.0.6",
|
||||
"name": "yaeti",
|
||||
"escapedName": "yaeti",
|
||||
"rawSpec": "^0.0.6",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.0.6"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/websocket"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/yaeti/-/yaeti-0.0.6.tgz",
|
||||
"_shasum": "f26f484d72684cf42bedfb76970aa1608fbf9577",
|
||||
"_spec": "yaeti@^0.0.6",
|
||||
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\websocket",
|
||||
"author": {
|
||||
"name": "Iñaki Baz Castillo",
|
||||
"email": "ibc@aliax.net"
|
||||
},
|
||||
"browser": {
|
||||
"./lib/Event.js": "./lib/Event.browser.js"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ibc/yaeti/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Yet Another EventTarget Implementation",
|
||||
"devDependencies": {
|
||||
"gulp": "git+https://github.com/gulpjs/gulp.git#4.0",
|
||||
"gulp-jscs": "^1.6.0",
|
||||
"gulp-jscs-stylish": "^1.1.0",
|
||||
"gulp-jshint": "^1.11.2",
|
||||
"jshint-stylish": "~1.0.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.32"
|
||||
},
|
||||
"homepage": "https://github.com/ibc/yaeti#readme",
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "yaeti",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ibc/yaeti.git"
|
||||
},
|
||||
"version": "0.0.6"
|
||||
}
|
||||
Reference in new issue
Block a user