fastchar-dom-plugin
Version:
Chrome插件,用于操作HTML的DOM
157 lines (156 loc) • 5.24 kB
JavaScript
define(["require", "exports"], function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FastConstant = void 0;
var FastConstant;
(function (FastConstant) {
/**
* 工具类
* @author 沈建(Janesen)
*/
var FastHelper = /** @class */ (function () {
function FastHelper() {
}
/**
* 构建唯一标识符
* @author Janesen
* @private
*/
FastHelper.buildUDID = function () {
var d = new Date().getTime();
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c == 'x' ? r : (r & 0x3 | 0x8)).toString(16);
});
};
return FastHelper;
}());
FastConstant.FastHelper = FastHelper;
/**
* FastDOM对象
* @author 沈建(Janesen)
*/
var FastDOM = /** @class */ (function () {
function FastDOM() {
}
/**
* 是否进入调试模式
*/
FastDOM.debug = false;
/**
* 插件当前版本号
*/
FastDOM.PLUGIN_VERSION = "2.1.5";
/**
* 插件下载地址
*/
FastDOM.PLUGIN_DOWNLOAD_URL = "https://www.fastchar.com/fastchar-dom-plugin.zip";
/**
* 是否采用长链接方式
*/
FastDOM.USE_RUNTIME_CONNECT = true;
/**
* 执行请求的标签名称
*/
FastDOM.DOM_TAG_NAME = "fastchar-dom-plugin";
/**
* 之前请求携带的数据
*/
FastDOM.DOM_DATA_NAME = "fastchar-dom-data";
/**
* 数据是否已接收
*/
FastDOM.DOM_DATA_RECEIVE = "fastchar-dom-data-receive";
/**
* 执行操作统计
*/
FastDOM.DOM_DATA_INVOKE_COUNT = "fastchar-dom-data-invoke-count";
/**
* 预计回调总数
*/
FastDOM.DOM_DATA_CALLBACK_TOTAL = "fastchar-dom-data-callback-total";
/**
* 回调不限次数
*/
FastDOM.DOM_DATA_CALLBACK_ALWAYS = "fastchar-dom-data-callback-always";
/**
* 回调数据的标签名
*/
FastDOM.DOM_DATA_CALLBACK_TAG_NAME = "fastchar-dom-callback";
/**
* 错误消息
*/
FastDOM.DOME_DATA_ERROR = "fastchar-dom-error";
/**
* 是否已加载插件
*/
FastDOM.DOM_PLUGIN = "fastchar-dom-plugin";
/**
* 加载插件版本
*/
FastDOM.DOM_PLUGIN_VERSION = "fastchar-dom-plugin-version";
/**
* 执行方法超时时间,单位:毫秒
*/
FastDOM.DOM_INVOKE_TIMEOUT = 15000;
/**
* 内容页面保活心跳间隔,单位:毫秒
*/
FastDOM.DOM_CONTENT_IDLE_DURATION = 100;
/**
* 内容页面失效时间,单位:毫秒
*/
FastDOM.DOM_CONTENT_TIMEOUT = 3000;
/**
* 背景页心跳器,单位:毫秒
*/
FastDOM.DOM_BACKGROUND_IDLE_DURATION = 100;
return FastDOM;
}());
FastConstant.FastDOM = FastDOM;
/**
* 执行DOM相关的事件
* @author 沈建(Janesen)
*/
var FastDOMEvents = /** @class */ (function () {
function FastDOMEvents() {
}
/**
* 事件注册链接
*/
FastDOMEvents.ON_REGISTER_CONNECT = "OnRegisterConnect";
/**
* 事件:执行方法
*/
FastDOMEvents.ON_INVOKE_METHOD = "OnInvokeMethod";
/**
* 事件:回调方法
*/
FastDOMEvents.ON_RETURN_METHOD = "OnReturnMethod";
/**
* 事件:检查消息
*/
FastDOMEvents.ON_WATCH_MESSAGE = "OnWatchMessage";
/**
* 事件:心跳
*/
FastDOMEvents.ON_IDLE = "OnIdle";
return FastDOMEvents;
}());
FastConstant.FastDOMEvents = FastDOMEvents;
/**
* window.postMessage事件类型
*/
var WindowMessageEvents = /** @class */ (function () {
function WindowMessageEvents() {
}
/**
* 网络请求响应事件
*/
WindowMessageEvents.HTTP_RESPONSE_LISTENER = "HTTP_RESPONSE_LISTENER";
return WindowMessageEvents;
}());
FastConstant.WindowMessageEvents = WindowMessageEvents;
})(FastConstant = exports.FastConstant || (exports.FastConstant = {}));
});