MyNote/Content/way.js
(开头部分) 42KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
(function (root, factory) {
if (typeof define === "function" && define.amd) {
define(factory);
} else if (typeof exports === "object") {
module.exports = factory();
} else {
root.way = factory();
}
}(this, function () {
"use strict";
var way, w, tagPrefix = "way";
//////////////////////////////
// EVENT EMITTER DEFINITION //
//////////////////////////////
var EventEmitter = function () {
this._watchers = {};
this._watchersAll = {};
};
EventEmitter.prototype.constructor = EventEmitter;
EventEmitter.prototype.watchAll = function(handler) {
this._watchersAll = this._watchersAll || [];
if (!_w.contains(this._watchersAll, handler)) { this._watchersAll.push(handler); }
}
EventEmitter.prototype.watch = function(selector, handler) {
if (!this._watchers) { this._watchers = {}; }
this._watchers[selector] = this._watchers[selector] || [];
this._watchers[selector].push(handler);
}
EventEmitter.prototype.findWatcherDeps = function(selector) {
// Go up to look for parent watchers
// ex: if "some.nested.value" is the selector, it should also trigger for "some"
var result = [];
var watchers = _w.keys(this._watchers);
watchers.forEach(function(watcher) {
if (startsWith(selector, watcher)) { result.push(watcher); }
});
return result;
}
EventEmitter.prototype.emitChange = function(selector /* , arguments */) {
后面还有 1664 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。