This commit is contained in:
dela
2026-02-21 18:27:49 +08:00
parent 0ac4b23f07
commit 5dc86ccfbf
270 changed files with 49508 additions and 4636 deletions

22
node_modules/event-lite/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015-2023 Yusuke Kawasaki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

88
node_modules/event-lite/README.md generated vendored Normal file
View File

@@ -0,0 +1,88 @@
# event-lite.js
[![Node.js CI](https://github.com/kawanet/event-lite/workflows/Node.js%20CI/badge.svg?branch=master)](https://github.com/kawanet/event-lite/actions/)
[![npm version](https://badge.fury.io/js/event-lite.svg)](https://www.npmjs.com/package/event-lite)
[![gzip size](https://img.badgesize.io/https://unpkg.com/event-lite/dist/event-lite.min.js?compression=gzip)](https://unpkg.com/event-lite/dist/event-lite.min.js)
Light-weight EventEmitter (less than 1KB when gzipped)
### Usage
```js
const EventLite = require("event-lite");
function MyClass() {...} // your class
EventLite.mixin(MyClass.prototype); // import event methods
const obj = new MyClass();
obj.on("foo", function(v) {...}); // add event listener
obj.once("bar", function(v) {...}); // add one-time event listener
obj.emit("foo", v); // dispatch event
obj.emit("bar", v); // dispatch another event
obj.off("foo"); // remove event listener
```
### Node.js
```sh
npm install event-lite --save
```
### Browsers
```html
<script src="https://cdn.jsdelivr.net/npm/event-lite/dist/event-lite.min.js"></script>
```
### TypeScript
```typescript
import EventLite = require("event-lite");
class MyClass extends EventLite {
// your class
}
const obj = new MyClass();
obj.on("foo", v => {...}); // add event listener
obj.once("bar", v => {...}); // add one-time event listener
obj.emit("foo", v); // dispatch event
obj.emit("bar", v); // dispatch another event
obj.off("foo"); // remove event listener
```
### Repository
- https://github.com/kawanet/event-lite
### Documentation
- http://kawanet.github.io/event-lite/EventLite.html
### See Also
- https://nodejs.org/api/events.html
### License
The MIT License (MIT)
Copyright (c) 2015-2023 Yusuke Kawasaki
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

2
node_modules/event-lite/browser/import.js generated vendored Normal file
View File

@@ -0,0 +1,2 @@
/* globals EventLite */
module.exports = EventLite;

1
node_modules/event-lite/dist/event-lite.min.js generated vendored Normal file
View File

@@ -0,0 +1 @@
function EventLite(){if(!(this instanceof EventLite))return new EventLite}!function(e){"undefined"!=typeof module&&(module.exports=e);var n="listeners",t={on:function(e,n){return f(this,e).push(n),this},once:function(e,n){var t=this;return i.originalListener=n,f(t,e).push(i),t;function i(){r.call(t,e,i),n.apply(this,arguments)}},off:r,emit:function(e,n){var t=this,i=f(t,e,!0);if(!i)return!1;var r=arguments.length;if(1===r)i.forEach((function(e){e.call(t)}));else if(2===r)i.forEach((function(e){e.call(t,n)}));else{var l=Array.prototype.slice.call(arguments,1);i.forEach((function(e){e.apply(t,l)}))}return!!i.length}};function i(e){for(var n in t)e[n]=t[n];return e}function r(e,t){var i,l=this;if(arguments.length){if(t){if(i=f(l,e,!0)){if(!(i=i.filter((function(e){return e!==t&&e.originalListener!==t}))).length)return r.call(l,e);l[n][e]=i}}else if((i=l[n])&&(delete i[e],!Object.keys(i).length))return r.call(l)}else delete l[n];return l}function f(e,t,i){if(!i||e[n]){var r=e[n]||(e[n]={});return r[t]||(r[t]=[])}}i(e.prototype),e.mixin=i}(EventLite);

15
node_modules/event-lite/event-lite.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
// event-lite.d.ts
declare class EventLite {
static mixin(proto: any): any;
on(event: string, listener: (...args: any[]) => void): this;
once(event: string, listener: (...args: any[]) => void): this;
off(event: string, listener: (...args: any[]) => void): this;
emit(event: string, ...args: any[]): boolean;
}
export = EventLite;

180
node_modules/event-lite/event-lite.js generated vendored Normal file
View File

@@ -0,0 +1,180 @@
/**
* event-lite.js - Light-weight EventEmitter (less than 1KB when gzipped)
*
* @copyright Yusuke Kawasaki
* @license MIT
* @constructor
* @see https://github.com/kawanet/event-lite
* @see http://kawanet.github.io/event-lite/EventLite.html
* @example
* var EventLite = require("event-lite");
*
* function MyClass() {...} // your class
*
* EventLite.mixin(MyClass.prototype); // import event methods
*
* var obj = new MyClass();
* obj.on("foo", function() {...}); // add event listener
* obj.once("bar", function() {...}); // add one-time event listener
* obj.emit("foo"); // dispatch event
* obj.emit("bar"); // dispatch another event
* obj.off("foo"); // remove event listener
*/
function EventLite() {
if (!(this instanceof EventLite)) return new EventLite();
}
(function(EventLite) {
// export the class for node.js
if ("undefined" !== typeof module) module.exports = EventLite;
// property name to hold listeners
var LISTENERS = "listeners";
// methods to export
var methods = {
on: on,
once: once,
off: off,
emit: emit
};
// mixin to self
mixin(EventLite.prototype);
// export mixin function
EventLite.mixin = mixin;
/**
* Import on(), once(), off() and emit() methods into target object.
*
* @function EventLite.mixin
* @param target {Prototype}
*/
function mixin(target) {
for (var key in methods) {
target[key] = methods[key];
}
return target;
}
/**
* Add an event listener.
*
* @function EventLite.prototype.on
* @param type {string}
* @param func {Function}
* @returns {EventLite} Self for method chaining
*/
function on(type, func) {
getListeners(this, type).push(func);
return this;
}
/**
* Add one-time event listener.
*
* @function EventLite.prototype.once
* @param type {string}
* @param func {Function}
* @returns {EventLite} Self for method chaining
*/
function once(type, func) {
var that = this;
wrap.originalListener = func;
getListeners(that, type).push(wrap);
return that;
function wrap() {
off.call(that, type, wrap);
func.apply(this, arguments);
}
}
/**
* Remove an event listener.
*
* @function EventLite.prototype.off
* @param [type] {string}
* @param [func] {Function}
* @returns {EventLite} Self for method chaining
*/
function off(type, func) {
var that = this;
var listners;
if (!arguments.length) {
delete that[LISTENERS];
} else if (!func) {
listners = that[LISTENERS];
if (listners) {
delete listners[type];
if (!Object.keys(listners).length) return off.call(that);
}
} else {
listners = getListeners(that, type, true);
if (listners) {
listners = listners.filter(ne);
if (!listners.length) return off.call(that, type);
that[LISTENERS][type] = listners;
}
}
return that;
function ne(test) {
return test !== func && test.originalListener !== func;
}
}
/**
* Dispatch (trigger) an event.
*
* @function EventLite.prototype.emit
* @param type {string}
* @param [value] {*}
* @returns {boolean} True when a listener received the event
*/
function emit(type, value) {
var that = this;
var listeners = getListeners(that, type, true);
if (!listeners) return false;
var arglen = arguments.length;
if (arglen === 1) {
listeners.forEach(zeroarg);
} else if (arglen === 2) {
listeners.forEach(onearg);
} else {
var args = Array.prototype.slice.call(arguments, 1);
listeners.forEach(moreargs);
}
return !!listeners.length;
function zeroarg(func) {
func.call(that);
}
function onearg(func) {
func.call(that, value);
}
function moreargs(func) {
func.apply(that, args);
}
}
/**
* @ignore
*/
function getListeners(that, type, readonly) {
if (readonly && !that[LISTENERS]) return;
var listeners = that[LISTENERS] || (that[LISTENERS] = {});
return listeners[type] || (listeners[type] = []);
}
})(EventLite);

62
node_modules/event-lite/package.json generated vendored Normal file
View File

@@ -0,0 +1,62 @@
{
"name": "event-lite",
"description": "Light-weight EventEmitter (less than 1KB when gzipped)",
"version": "0.1.3",
"author": "@kawanet",
"bugs": {
"url": "https://github.com/kawanet/event-lite/issues"
},
"contributors": [
"Joshua Wise <josh@joshuawise.ninja>"
],
"devDependencies": {
"browserify": "^17.0.0",
"browserify-sed": "^0.8.0",
"jsdoc": "^3.5.5",
"jshint": "^2.13.6",
"mocha": "^10.2.0",
"terser": "^5.16.3"
},
"files": [
"browser/import.js",
"dist/event-lite.min.js",
"event-lite.d.ts",
"event-lite.js"
],
"homepage": "https://github.com/kawanet/event-lite",
"jshintConfig": {
"bitwise": true,
"browser": true,
"eqeqeq": true,
"mocha": true,
"noarg": true,
"nocomma": true,
"node": true,
"nonbsp": true,
"nonew": true,
"regexp": true,
"undef": true,
"unused": true
},
"keywords": [
"browser",
"emitter",
"event",
"eventlistener",
"fire",
"trigger"
],
"license": "MIT",
"main": "event-lite.js",
"repository": {
"type": "git",
"url": "https://github.com/kawanet/event-lite.git"
},
"scripts": {
"build": "make clean all",
"fixpack": "fixpack",
"prepack": "npm run build && npm test",
"test": "make test"
},
"typings": "event-lite.d.ts"
}