mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-03 09:49:28 +02:00
Moving to node_modules folder to make easier to upgrade
trying to move from Bootstrap 3 to Bootstrap 5
This commit is contained in:
parent
047e363a16
commit
d4d042e041
8460 changed files with 1355889 additions and 547977 deletions
112
node_modules/ev-emitter/README.md
generated
vendored
Normal file
112
node_modules/ev-emitter/README.md
generated
vendored
Normal file
|
@ -0,0 +1,112 @@
|
|||
# EvEmitter
|
||||
|
||||
_Lil' event emitter_ — add a little pub/sub
|
||||
|
||||
EvEmitter adds publish/subscribe pattern to a browser class. It's a smaller version of [Olical/EventEmitter](https://github.com/Olical/EventEmitter). That EventEmitter is full featured, widely used, and great. This EvEmitter has just the base event functionality to power the event API in libraries like [Isotope](https://isotope.metafizzy.co), [Flickity](https://flickity.metafizzy.co), [Masonry](https://masonry.desandro.com), and [imagesLoaded](https://imagesloaded.desandro.com).
|
||||
|
||||
## API
|
||||
|
||||
``` js
|
||||
// class inheritence
|
||||
class MyClass extends EvEmitter {}
|
||||
|
||||
// mixin prototype
|
||||
Object.assign( MyClass.prototype, EvEmitter.prototype );
|
||||
|
||||
// single instance
|
||||
let emitter = new EvEmitter();
|
||||
```
|
||||
|
||||
### on
|
||||
|
||||
Add an event listener.
|
||||
|
||||
``` js
|
||||
emitter.on( eventName, listener )
|
||||
```
|
||||
|
||||
+ `eventName` - _String_ - name of the event
|
||||
+ `listener` - _Function_
|
||||
|
||||
### off
|
||||
|
||||
Remove an event listener.
|
||||
|
||||
``` js
|
||||
emitter.off( eventName, listener )
|
||||
```
|
||||
|
||||
### once
|
||||
|
||||
Add an event listener to be triggered only once.
|
||||
|
||||
``` js
|
||||
emitter.once( eventName, listener )
|
||||
```
|
||||
|
||||
### emitEvent
|
||||
|
||||
Trigger an event.
|
||||
|
||||
``` js
|
||||
emitter.emitEvent( eventName, args )
|
||||
```
|
||||
|
||||
+ `eventName` - _String_ - name of the event
|
||||
+ `args` - _Array_ - arguments passed to listeners
|
||||
|
||||
### allOff
|
||||
|
||||
Removes all event listeners.
|
||||
|
||||
``` js
|
||||
emitter.allOff()
|
||||
```
|
||||
|
||||
## Code example
|
||||
|
||||
``` js
|
||||
// create event emitter
|
||||
var emitter = new EvEmitter();
|
||||
|
||||
// listeners
|
||||
function hey( a, b, c ) {
|
||||
console.log( 'Hey', a, b, c )
|
||||
}
|
||||
|
||||
function ho( a, b, c ) {
|
||||
console.log( 'Ho', a, b, c )
|
||||
}
|
||||
|
||||
function letsGo( a, b, c ) {
|
||||
console.log( 'Lets go', a, b, c )
|
||||
}
|
||||
|
||||
// bind listeners
|
||||
emitter.on( 'rock', hey )
|
||||
emitter.on( 'rock', ho )
|
||||
// trigger letsGo once
|
||||
emitter.once( 'rock', letsGo )
|
||||
|
||||
// emit event
|
||||
emitter.emitEvent( 'rock', [ 1, 2, 3 ] )
|
||||
// => 'Hey', 1, 2, 3
|
||||
// => 'Ho', 1, 2, 3
|
||||
// => 'Lets go', 1, 2, 3
|
||||
|
||||
// unbind
|
||||
emitter.off( 'rock', ho )
|
||||
|
||||
emitter.emitEvent( 'rock', [ 4, 5, 6 ] )
|
||||
// => 'Hey' 4, 5, 6
|
||||
```
|
||||
|
||||
## Browser support
|
||||
|
||||
EvEmitter v2 uses ES6 features like [for...of loops](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of) and [class definition](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes) as such it supports Chrome 49+, Firefox 45+, Safari 9+, and Edge 13+.
|
||||
|
||||
For older browser support, use [EvEmitter v1](https://github.com/metafizzy/ev-emitter/releases/tag/v1.1.1).
|
||||
|
||||
## License
|
||||
|
||||
EvEmitter is released under the [MIT License](http://desandro.mit-license.org/). Have at it.
|
29
node_modules/ev-emitter/bower.json
generated
vendored
Normal file
29
node_modules/ev-emitter/bower.json
generated
vendored
Normal file
|
@ -0,0 +1,29 @@
|
|||
{
|
||||
"name": "ev-emitter",
|
||||
"main": "ev-emitter.js",
|
||||
"homepage": "https://github.com/metafizzy/ev-emitter",
|
||||
"authors": [
|
||||
"David DeSandro <desandrocodes@gmail.com>"
|
||||
],
|
||||
"description": "lil' event emitter",
|
||||
"moduleType": [
|
||||
"amd",
|
||||
"globals",
|
||||
"node"
|
||||
],
|
||||
"keywords": [
|
||||
"event",
|
||||
"emitter",
|
||||
"pubsub"
|
||||
],
|
||||
"license": "MIT",
|
||||
"ignore": [
|
||||
"**/.*",
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"test",
|
||||
"tests",
|
||||
"sandbox",
|
||||
"package.json"
|
||||
]
|
||||
}
|
100
node_modules/ev-emitter/ev-emitter.js
generated
vendored
Normal file
100
node_modules/ev-emitter/ev-emitter.js
generated
vendored
Normal file
|
@ -0,0 +1,100 @@
|
|||
/**
|
||||
* EvEmitter v2.0.0
|
||||
* Lil' event emitter
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
( function( global, factory ) {
|
||||
// universal module definition
|
||||
if ( typeof module == 'object' && module.exports ) {
|
||||
// CommonJS - Browserify, Webpack
|
||||
module.exports = factory();
|
||||
} else {
|
||||
// Browser globals
|
||||
global.EvEmitter = factory();
|
||||
}
|
||||
|
||||
}( typeof window != 'undefined' ? window : this, function() {
|
||||
|
||||
function EvEmitter() {}
|
||||
|
||||
let proto = EvEmitter.prototype;
|
||||
|
||||
proto.on = function( eventName, listener ) {
|
||||
if ( !eventName || !listener ) return this;
|
||||
|
||||
// set events hash
|
||||
let events = this._events = this._events || {};
|
||||
// set listeners array
|
||||
let listeners = events[ eventName ] = events[ eventName ] || [];
|
||||
// only add once
|
||||
if ( !listeners.includes( listener ) ) {
|
||||
listeners.push( listener );
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
proto.once = function( eventName, listener ) {
|
||||
if ( !eventName || !listener ) return this;
|
||||
|
||||
// add event
|
||||
this.on( eventName, listener );
|
||||
// set once flag
|
||||
// set onceEvents hash
|
||||
let onceEvents = this._onceEvents = this._onceEvents || {};
|
||||
// set onceListeners object
|
||||
let onceListeners = onceEvents[ eventName ] = onceEvents[ eventName ] || {};
|
||||
// set flag
|
||||
onceListeners[ listener ] = true;
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
proto.off = function( eventName, listener ) {
|
||||
let listeners = this._events && this._events[ eventName ];
|
||||
if ( !listeners || !listeners.length ) return this;
|
||||
|
||||
let index = listeners.indexOf( listener );
|
||||
if ( index != -1 ) {
|
||||
listeners.splice( index, 1 );
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
proto.emitEvent = function( eventName, args ) {
|
||||
let listeners = this._events && this._events[ eventName ];
|
||||
if ( !listeners || !listeners.length ) return this;
|
||||
|
||||
// copy over to avoid interference if .off() in listener
|
||||
listeners = listeners.slice( 0 );
|
||||
args = args || [];
|
||||
// once stuff
|
||||
let onceListeners = this._onceEvents && this._onceEvents[ eventName ];
|
||||
|
||||
for ( let listener of listeners ) {
|
||||
let isOnce = onceListeners && onceListeners[ listener ];
|
||||
if ( isOnce ) {
|
||||
// remove listener
|
||||
// remove before trigger to prevent recursion
|
||||
this.off( eventName, listener );
|
||||
// unset once flag
|
||||
delete onceListeners[ listener ];
|
||||
}
|
||||
// trigger listener
|
||||
listener.apply( this, args );
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
proto.allOff = function() {
|
||||
delete this._events;
|
||||
delete this._onceEvents;
|
||||
return this;
|
||||
};
|
||||
|
||||
return EvEmitter;
|
||||
|
||||
} ) );
|
73
node_modules/ev-emitter/package.json
generated
vendored
Normal file
73
node_modules/ev-emitter/package.json
generated
vendored
Normal file
|
@ -0,0 +1,73 @@
|
|||
{
|
||||
"_from": "ev-emitter@^2.1.0",
|
||||
"_id": "ev-emitter@2.1.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-73qJdHUbyfA6ykAvWf4bBV7fQNYVOPd9nA3qfiQkgKVgIBKro/MAfJnZgyayWUapHU0Y5Qk9unofK3WirjkrVQ==",
|
||||
"_location": "/ev-emitter",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "ev-emitter@^2.1.0",
|
||||
"name": "ev-emitter",
|
||||
"escapedName": "ev-emitter",
|
||||
"rawSpec": "^2.1.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.1.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/infinite-scroll"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/ev-emitter/-/ev-emitter-2.1.0.tgz",
|
||||
"_shasum": "0feaf873003db49c92ceb7d448111a952fb25ce2",
|
||||
"_spec": "ev-emitter@^2.1.0",
|
||||
"_where": "G:\\GDrive\\htdocs\\YouPHPTube\\node_modules\\infinite-scroll",
|
||||
"author": {
|
||||
"name": "David DeSandro"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/metafizzy/ev-emitter/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "lil' event emitter",
|
||||
"devDependencies": {
|
||||
"ava": "^3.14.0",
|
||||
"eslint": "^7.15.0",
|
||||
"eslint-plugin-metafizzy": "^1.1.1"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"plugins": [
|
||||
"metafizzy"
|
||||
],
|
||||
"extends": "plugin:metafizzy/base",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
},
|
||||
"env": {
|
||||
"browser": true,
|
||||
"commonjs": true
|
||||
}
|
||||
},
|
||||
"homepage": "https://github.com/metafizzy/ev-emitter#readme",
|
||||
"keywords": [
|
||||
"event",
|
||||
"emitter",
|
||||
"pubsub"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "ev-emitter.js",
|
||||
"name": "ev-emitter",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/metafizzy/ev-emitter.git"
|
||||
},
|
||||
"scripts": {
|
||||
"lint": "npx eslint .",
|
||||
"test": "npm run lint && ava"
|
||||
},
|
||||
"version": "2.1.0"
|
||||
}
|
193
node_modules/ev-emitter/test/test.js
generated
vendored
Normal file
193
node_modules/ev-emitter/test/test.js
generated
vendored
Normal file
|
@ -0,0 +1,193 @@
|
|||
const test = require('ava');
|
||||
const EvEmitter = require('../ev-emitter.js');
|
||||
|
||||
test( 'should emitEvent', function( t ) {
|
||||
let emitter = new EvEmitter();
|
||||
let didPop;
|
||||
emitter.on( 'pop', function() {
|
||||
didPop = true;
|
||||
} );
|
||||
emitter.emitEvent('pop');
|
||||
t.truthy( didPop, 'event emitted' );
|
||||
} );
|
||||
|
||||
test( 'emitEvent should pass argument to listener', function( t ) {
|
||||
let emitter = new EvEmitter();
|
||||
let result;
|
||||
function onPop( arg ) {
|
||||
result = arg;
|
||||
}
|
||||
emitter.on( 'pop', onPop );
|
||||
emitter.emitEvent( 'pop', [ 1 ] );
|
||||
t.is( result, 1, 'event emitted, arg passed' );
|
||||
} );
|
||||
|
||||
test( 'does not allow same listener to be added', function( t ) {
|
||||
let emitter = new EvEmitter();
|
||||
let ticks = 0;
|
||||
function onPop() {
|
||||
ticks++;
|
||||
}
|
||||
emitter.on( 'pop', onPop );
|
||||
emitter.on( 'pop', onPop );
|
||||
let _onPop = onPop;
|
||||
emitter.on( 'pop', _onPop );
|
||||
|
||||
emitter.emitEvent('pop');
|
||||
t.is( ticks, 1, '1 tick for same listener' );
|
||||
} );
|
||||
|
||||
test( 'should remove listener with .off()', function( t ) {
|
||||
let emitter = new EvEmitter();
|
||||
let ticks = 0;
|
||||
function onPop() {
|
||||
ticks++;
|
||||
}
|
||||
emitter.on( 'pop', onPop );
|
||||
emitter.emitEvent('pop');
|
||||
emitter.off( 'pop', onPop );
|
||||
emitter.emitEvent('pop');
|
||||
t.is( ticks, 1, '.off() removed listener' );
|
||||
|
||||
// reset
|
||||
let ary = [];
|
||||
ticks = 0;
|
||||
emitter.allOff();
|
||||
|
||||
function onPopA() {
|
||||
ticks++;
|
||||
ary.push('a');
|
||||
if ( ticks == 2 ) {
|
||||
emitter.off( 'pop', onPopA );
|
||||
}
|
||||
}
|
||||
function onPopB() {
|
||||
ary.push('b');
|
||||
}
|
||||
|
||||
emitter.on( 'pop', onPopA );
|
||||
emitter.on( 'pop', onPopB );
|
||||
emitter.emitEvent('pop'); // a,b
|
||||
emitter.emitEvent('pop'); // a,b - remove onPopA
|
||||
emitter.emitEvent('pop'); // b
|
||||
|
||||
t.is( ary.join(','), 'a,b,a,b,b', '.off in listener does not interfer' );
|
||||
|
||||
} );
|
||||
|
||||
test( 'should handle once()', function( t ) {
|
||||
let emitter = new EvEmitter();
|
||||
let ary = [];
|
||||
|
||||
emitter.on( 'pop', function() {
|
||||
ary.push('a');
|
||||
} );
|
||||
emitter.once( 'pop', function() {
|
||||
ary.push('b');
|
||||
} );
|
||||
emitter.on( 'pop', function() {
|
||||
ary.push('c');
|
||||
} );
|
||||
emitter.emitEvent('pop');
|
||||
emitter.emitEvent('pop');
|
||||
|
||||
t.is( ary.join(','), 'a,b,c,a,c', 'once listener triggered once' );
|
||||
|
||||
// reset
|
||||
emitter.allOff();
|
||||
ary = [];
|
||||
|
||||
// add two identical but not === listeners, only do one once
|
||||
emitter.on( 'pop', function() {
|
||||
ary.push('a');
|
||||
} );
|
||||
emitter.once( 'pop', function() {
|
||||
ary.push('a');
|
||||
} );
|
||||
emitter.emitEvent('pop');
|
||||
emitter.emitEvent('pop');
|
||||
|
||||
t.is( ary.join(','), 'a,a,a',
|
||||
'identical listeners do not interfere with once' );
|
||||
|
||||
} );
|
||||
|
||||
test( 'does not infinite loop in once()', function( t ) {
|
||||
let emitter = new EvEmitter();
|
||||
let ticks = 0;
|
||||
function onPop() {
|
||||
ticks++;
|
||||
if ( ticks < 4 ) {
|
||||
emitter.emitEvent('pop');
|
||||
}
|
||||
}
|
||||
|
||||
emitter.once( 'pop', onPop );
|
||||
emitter.emitEvent('pop');
|
||||
t.is( ticks, 1, '1 tick with emitEvent in once' );
|
||||
} );
|
||||
|
||||
test( 'handles emitEvent with no listeners', function( t ) {
|
||||
let emitter = new EvEmitter();
|
||||
t.notThrows( function() {
|
||||
emitter.emitEvent( 'pop', [ 1, 2, 3 ] );
|
||||
} );
|
||||
|
||||
function onPop() {}
|
||||
|
||||
emitter.on( 'pop', onPop );
|
||||
emitter.off( 'pop', onPop );
|
||||
|
||||
t.notThrows( function() {
|
||||
emitter.emitEvent( 'pop', [ 1, 2, 3 ] );
|
||||
} );
|
||||
|
||||
emitter.on( 'pop', onPop );
|
||||
emitter.emitEvent( 'pop', [ 1, 2, 3 ] );
|
||||
emitter.off( 'pop', onPop );
|
||||
|
||||
t.notThrows( function() {
|
||||
emitter.emitEvent( 'pop', [ 1, 2, 3 ] );
|
||||
} );
|
||||
} );
|
||||
|
||||
test( 'removes all listeners after allOff', function( t ) {
|
||||
let emitter = new EvEmitter();
|
||||
let ary = [];
|
||||
emitter.on( 'pop', function() {
|
||||
ary.push('a');
|
||||
} );
|
||||
emitter.on( 'pop', function() {
|
||||
ary.push('b');
|
||||
} );
|
||||
emitter.once( 'pop', function() {
|
||||
ary.push('c');
|
||||
} );
|
||||
|
||||
emitter.emitEvent('pop');
|
||||
emitter.allOff();
|
||||
emitter.emitEvent('pop');
|
||||
|
||||
t.is( ary.join(','), 'a,b,c', 'allOff removed listeners' );
|
||||
} );
|
||||
|
||||
test( 'class extends', function( t ) {
|
||||
class Widgey extends EvEmitter {}
|
||||
|
||||
let wijjy = new Widgey();
|
||||
|
||||
t.is( typeof wijjy.on, 'function' );
|
||||
t.is( typeof wijjy.off, 'function' );
|
||||
t.is( typeof wijjy.once, 'function' );
|
||||
} );
|
||||
|
||||
test( 'Object.assign prototype', function( t ) {
|
||||
function Thingie() {}
|
||||
Object.assign( Thingie.prototype, EvEmitter.prototype );
|
||||
|
||||
let thing = new Thingie();
|
||||
|
||||
t.is( typeof thing.on, 'function' );
|
||||
t.is( typeof thing.off, 'function' );
|
||||
t.is( typeof thing.once, 'function' );
|
||||
} );
|
Loading…
Add table
Add a link
Reference in a new issue