mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-18 19:01:20 -08:00
refactor(thumbnail): [PKG-TOOL-THUMB-04] type runtime modules and retain emitter attribution
This commit is contained in:
1 parent
efd9f42fb9
commit
15485b6420
37 files changed
+8446
-152
No files matched your search
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"reviewedAt": "2026-09-12T20:36:43.265Z",
|
||||
"referenceVersion": "2.1.0",
|
||||
"sources": [
|
||||
{
|
||||
"file": "refactor/baselines/thumbnail-vendor/tiny-emitter-2.1.0.txt",
|
||||
"url": "https://raw.githubusercontent.com/scottcorgan/tiny-emitter/2.1.0/index.js",
|
||||
"sha256": "3e3679233f20177d63d253e7c2645024fef51731d05df15621c62a48ba98e0d3"
|
||||
},
|
||||
{
|
||||
"file": "refactor/baselines/thumbnail-vendor/tiny-emitter-license.txt",
|
||||
"url": "https://raw.githubusercontent.com/scottcorgan/tiny-emitter/2.1.0/LICENSE",
|
||||
"sha256": "aada4c7da6a5be46beadf9d4f40d7dba9e222e57180d46289b2bb9112e65daae"
|
||||
},
|
||||
{
|
||||
"file": "refactor/baselines/thumbnail-vendor/tiny-emitter-package.json",
|
||||
"url": "https://raw.githubusercontent.com/scottcorgan/tiny-emitter/2.1.0/package.json",
|
||||
"sha256": "f5328afd1e742ba9b107e316e5fc4c74ec81201bafad8eb8e6dc456ef6d628de"
|
||||
}
|
||||
],
|
||||
"limitation": "Pinned upstream comparison reference. Structural correspondence and the recovered 3.5.31 dependency establish attribution, not the exact original copy revision or complete npm archive."
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
function E () {
|
||||
// Keep this empty so it's easier to inherit from
|
||||
// (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)
|
||||
}
|
||||
|
||||
E.prototype = {
|
||||
on: function (name, callback, ctx) {
|
||||
var e = this.e || (this.e = {});
|
||||
|
||||
(e[name] || (e[name] = [])).push({
|
||||
fn: callback,
|
||||
ctx: ctx
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
once: function (name, callback, ctx) {
|
||||
var self = this;
|
||||
function listener () {
|
||||
self.off(name, listener);
|
||||
callback.apply(ctx, arguments);
|
||||
};
|
||||
|
||||
listener._ = callback
|
||||
return this.on(name, listener, ctx);
|
||||
},
|
||||
|
||||
emit: function (name) {
|
||||
var data = [].slice.call(arguments, 1);
|
||||
var evtArr = ((this.e || (this.e = {}))[name] || []).slice();
|
||||
var i = 0;
|
||||
var len = evtArr.length;
|
||||
|
||||
for (i; i < len; i++) {
|
||||
evtArr[i].fn.apply(evtArr[i].ctx, data);
|
||||
}
|
||||
|
||||
return this;
|
||||
},
|
||||
|
||||
off: function (name, callback) {
|
||||
var e = this.e || (this.e = {});
|
||||
var evts = e[name];
|
||||
var liveEvents = [];
|
||||
|
||||
if (evts && callback) {
|
||||
for (var i = 0, len = evts.length; i < len; i++) {
|
||||
if (evts[i].fn !== callback && evts[i].fn._ !== callback)
|
||||
liveEvents.push(evts[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// Remove event from queue to prevent memory leak
|
||||
// Suggested by https://github.com/lazd
|
||||
// Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910
|
||||
|
||||
(liveEvents.length)
|
||||
? e[name] = liveEvents
|
||||
: delete e[name];
|
||||
|
||||
return this;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = E;
|
||||
module.exports.TinyEmitter = E;
|
||||
@@ -0,0 +1,22 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Scott Corgan
|
||||
|
||||
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.
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"name": "tiny-emitter",
|
||||
"version": "2.1.0",
|
||||
"description": "A tiny (less than 1k) event emitter library",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test-node": "tape test/index.js | tap-format-spec",
|
||||
"test": "testling | tap-format-spec",
|
||||
"bundle": "node_modules/.bin/browserify index.js > dist/tinyemitter.js -s TinyEmitter && echo 'Bundled'",
|
||||
"minify": "node_modules/.bin/uglifyjs dist/tinyemitter.js -o dist/tinyemitter.min.js -m && echo 'Minified'",
|
||||
"build": "npm test && npm run bundle && npm run minify",
|
||||
"size": "node_modules/.bin/uglifyjs index.js -o minified.js -m && ls -l && rm minified.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/scottcorgan/tiny-emitter.git"
|
||||
},
|
||||
"keywords": [
|
||||
"event",
|
||||
"emitter",
|
||||
"pubsub",
|
||||
"tiny",
|
||||
"events",
|
||||
"bind"
|
||||
],
|
||||
"author": "Scott Corgan",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/scottcorgan/tiny-emitter/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tap-format/spec": "0.2.0",
|
||||
"browserify": "11.2.0",
|
||||
"tape": "4.2.1",
|
||||
"testling": "1.7.1",
|
||||
"uglify-js": "2.5.0"
|
||||
},
|
||||
"testling": {
|
||||
"files": [
|
||||
"test/index.js"
|
||||
],
|
||||
"browsers": [
|
||||
"iexplore/10.0",
|
||||
"iexplore/9.0",
|
||||
"firefox/16..latest",
|
||||
"chrome/22..latest",
|
||||
"safari/5.1..latest",
|
||||
"ipad/6.0..latest",
|
||||
"iphone/6.0..latest",
|
||||
"android-browser/4.2..latest"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user