fast-vue-multi-pages 1.0.11 → 1.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/FastVueMultiTool.d.ts +5 -0
 - package/dist/cjs/FastVueMultiTool.js +5 -0
 - package/dist/cjs/other/FastVueMultiWatcher.d.ts +23 -0
 - package/dist/cjs/other/FastVueMultiWatcher.js +111 -0
 - package/dist/cjs/vue/FastVueMultiConfig.js +3 -3
 - package/dist/esm/FastVueMultiTool.d.ts +5 -0
 - package/dist/esm/FastVueMultiTool.js +5 -1
 - package/dist/esm/other/FastVueMultiWatcher.d.ts +23 -0
 - package/dist/esm/other/FastVueMultiWatcher.js +119 -0
 - package/dist/esm/vue/FastVueMultiConfig.js +3 -3
 - package/package.json +1 -1
 - package/vue/FastVueMultiConfig.js +3 -3
 
| 
         @@ -11,6 +11,7 @@ import { FastVueMultiElement } from "./other/FastVueMultiElement"; 
     | 
|
| 
       11 
11 
     | 
    
         
             
            import { FastVueMultiWindow } from "./other/FastVueMultiWindow";
         
     | 
| 
       12 
12 
     | 
    
         
             
            import { FastVueMultiFile } from "./other/FastVueMultiFile";
         
     | 
| 
       13 
13 
     | 
    
         
             
            import { FastVueMultiBase64 } from "./other/FastVueMultiBase64";
         
     | 
| 
      
 14 
     | 
    
         
            +
            import { FastVueMultiWatcher } from "./other/FastVueMultiWatcher";
         
     | 
| 
       14 
15 
     | 
    
         
             
            /**
         
     | 
| 
       15 
16 
     | 
    
         
             
             * FastBaseApp 手机APP功能工具类
         
     | 
| 
       16 
17 
     | 
    
         
             
             */
         
     | 
| 
         @@ -71,4 +72,8 @@ export declare class FastVueMultiTool { 
     | 
|
| 
       71 
72 
     | 
    
         
             
                 * base64相关操作
         
     | 
| 
       72 
73 
     | 
    
         
             
                 */
         
     | 
| 
       73 
74 
     | 
    
         
             
                static Base64: typeof FastVueMultiBase64;
         
     | 
| 
      
 75 
     | 
    
         
            +
                /**
         
     | 
| 
      
 76 
     | 
    
         
            +
                 * 监听者
         
     | 
| 
      
 77 
     | 
    
         
            +
                 */
         
     | 
| 
      
 78 
     | 
    
         
            +
                static Watcher: typeof FastVueMultiWatcher;
         
     | 
| 
       74 
79 
     | 
    
         
             
            }
         
     | 
| 
         @@ -15,6 +15,7 @@ const FastVueMultiElement_1 = require("./other/FastVueMultiElement"); 
     | 
|
| 
       15 
15 
     | 
    
         
             
            const FastVueMultiWindow_1 = require("./other/FastVueMultiWindow");
         
     | 
| 
       16 
16 
     | 
    
         
             
            const FastVueMultiFile_1 = require("./other/FastVueMultiFile");
         
     | 
| 
       17 
17 
     | 
    
         
             
            const FastVueMultiBase64_1 = require("./other/FastVueMultiBase64");
         
     | 
| 
      
 18 
     | 
    
         
            +
            const FastVueMultiWatcher_1 = require("./other/FastVueMultiWatcher");
         
     | 
| 
       18 
19 
     | 
    
         
             
            /**
         
     | 
| 
       19 
20 
     | 
    
         
             
             * FastBaseApp 手机APP功能工具类
         
     | 
| 
       20 
21 
     | 
    
         
             
             */
         
     | 
| 
         @@ -75,5 +76,9 @@ class FastVueMultiTool { 
     | 
|
| 
       75 
76 
     | 
    
         
             
                 * base64相关操作
         
     | 
| 
       76 
77 
     | 
    
         
             
                 */
         
     | 
| 
       77 
78 
     | 
    
         
             
                static Base64 = FastVueMultiBase64_1.FastVueMultiBase64;
         
     | 
| 
      
 79 
     | 
    
         
            +
                /**
         
     | 
| 
      
 80 
     | 
    
         
            +
                 * 监听者
         
     | 
| 
      
 81 
     | 
    
         
            +
                 */
         
     | 
| 
      
 82 
     | 
    
         
            +
                static Watcher = FastVueMultiWatcher_1.FastVueMultiWatcher;
         
     | 
| 
       78 
83 
     | 
    
         
             
            }
         
     | 
| 
       79 
84 
     | 
    
         
             
            exports.FastVueMultiTool = FastVueMultiTool;
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /**
         
     | 
| 
      
 2 
     | 
    
         
            +
             * 事件监听器
         
     | 
| 
      
 3 
     | 
    
         
            +
             */
         
     | 
| 
      
 4 
     | 
    
         
            +
            export declare class FastVueMultiWatcher {
         
     | 
| 
      
 5 
     | 
    
         
            +
                private static getWatcherConfig;
         
     | 
| 
      
 6 
     | 
    
         
            +
                private static getWatcherTimer;
         
     | 
| 
      
 7 
     | 
    
         
            +
                private static setWatcherTimer;
         
     | 
| 
      
 8 
     | 
    
         
            +
                private static stopWatcherTimer;
         
     | 
| 
      
 9 
     | 
    
         
            +
                private static startTimer;
         
     | 
| 
      
 10 
     | 
    
         
            +
                private static pushWatcher;
         
     | 
| 
      
 11 
     | 
    
         
            +
                /**
         
     | 
| 
      
 12 
     | 
    
         
            +
                 * 启动一个事件监听器
         
     | 
| 
      
 13 
     | 
    
         
            +
                 * @param eventName 事件名称 string|array
         
     | 
| 
      
 14 
     | 
    
         
            +
                 * @param callback 事件触发的回调  function(eventName,eventParams){}
         
     | 
| 
      
 15 
     | 
    
         
            +
                 */
         
     | 
| 
      
 16 
     | 
    
         
            +
                static startWatcher(eventName: any, callback: any): void;
         
     | 
| 
      
 17 
     | 
    
         
            +
                /**
         
     | 
| 
      
 18 
     | 
    
         
            +
                 * 通知事件监听者
         
     | 
| 
      
 19 
     | 
    
         
            +
                 * @param eventName 事件名称 string|array
         
     | 
| 
      
 20 
     | 
    
         
            +
                 * @param eventParams 携带参数 any
         
     | 
| 
      
 21 
     | 
    
         
            +
                 */
         
     | 
| 
      
 22 
     | 
    
         
            +
                static notifyWatcher(eventName: any, eventParams?: any): void;
         
     | 
| 
      
 23 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,111 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            "use strict";
         
     | 
| 
      
 2 
     | 
    
         
            +
            Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
      
 3 
     | 
    
         
            +
            exports.FastVueMultiWatcher = void 0;
         
     | 
| 
      
 4 
     | 
    
         
            +
            const tslib_1 = require("tslib");
         
     | 
| 
      
 5 
     | 
    
         
            +
            const lodash_1 = tslib_1.__importDefault(require("lodash"));
         
     | 
| 
      
 6 
     | 
    
         
            +
            const js_cookie_1 = tslib_1.__importDefault(require("js-cookie"));
         
     | 
| 
      
 7 
     | 
    
         
            +
            /**
         
     | 
| 
      
 8 
     | 
    
         
            +
             * 事件监听器
         
     | 
| 
      
 9 
     | 
    
         
            +
             */
         
     | 
| 
      
 10 
     | 
    
         
            +
            class FastVueMultiWatcher {
         
     | 
| 
      
 11 
     | 
    
         
            +
                static getWatcherConfig() {
         
     | 
| 
      
 12 
     | 
    
         
            +
                    if (!window["__WATCHER_CONFIG"]) {
         
     | 
| 
      
 13 
     | 
    
         
            +
                        window["__WATCHER_CONFIG"] = {};
         
     | 
| 
      
 14 
     | 
    
         
            +
                    }
         
     | 
| 
      
 15 
     | 
    
         
            +
                    return window["__WATCHER_CONFIG"];
         
     | 
| 
      
 16 
     | 
    
         
            +
                }
         
     | 
| 
      
 17 
     | 
    
         
            +
                static getWatcherTimer() {
         
     | 
| 
      
 18 
     | 
    
         
            +
                    return window["__WATCHER_TIMER"];
         
     | 
| 
      
 19 
     | 
    
         
            +
                }
         
     | 
| 
      
 20 
     | 
    
         
            +
                static setWatcherTimer(timer) {
         
     | 
| 
      
 21 
     | 
    
         
            +
                    window["__WATCHER_TIMER"] = timer;
         
     | 
| 
      
 22 
     | 
    
         
            +
                }
         
     | 
| 
      
 23 
     | 
    
         
            +
                static stopWatcherTimer() {
         
     | 
| 
      
 24 
     | 
    
         
            +
                    if (this.getWatcherTimer()) {
         
     | 
| 
      
 25 
     | 
    
         
            +
                        clearTimeout(this.getWatcherTimer());
         
     | 
| 
      
 26 
     | 
    
         
            +
                    }
         
     | 
| 
      
 27 
     | 
    
         
            +
                }
         
     | 
| 
      
 28 
     | 
    
         
            +
                static startTimer() {
         
     | 
| 
      
 29 
     | 
    
         
            +
                    this.stopWatcherTimer();
         
     | 
| 
      
 30 
     | 
    
         
            +
                    this.setWatcherTimer(setTimeout(() => {
         
     | 
| 
      
 31 
     | 
    
         
            +
                        for (let eventName in this.getWatcherConfig()) {
         
     | 
| 
      
 32 
     | 
    
         
            +
                            let watchValue = js_cookie_1.default.get("EVENT@" + eventName);
         
     | 
| 
      
 33 
     | 
    
         
            +
                            let configs = this.getWatcherConfig()[eventName];
         
     | 
| 
      
 34 
     | 
    
         
            +
                            for (let config of configs) {
         
     | 
| 
      
 35 
     | 
    
         
            +
                                if (watchValue !== null && watchValue !== undefined && watchValue !== "null" && watchValue !== "undefined") {
         
     | 
| 
      
 36 
     | 
    
         
            +
                                    let timestamp = parseInt(watchValue);
         
     | 
| 
      
 37 
     | 
    
         
            +
                                    if (isNaN(timestamp)) {
         
     | 
| 
      
 38 
     | 
    
         
            +
                                        continue;
         
     | 
| 
      
 39 
     | 
    
         
            +
                                    }
         
     | 
| 
      
 40 
     | 
    
         
            +
                                    if (config.timestamp < timestamp) {
         
     | 
| 
      
 41 
     | 
    
         
            +
                                        let params = js_cookie_1.default.get("EVENT@PARMAS@" + eventName);
         
     | 
| 
      
 42 
     | 
    
         
            +
                                        if (params) {
         
     | 
| 
      
 43 
     | 
    
         
            +
                                            params = JSON.parse(params);
         
     | 
| 
      
 44 
     | 
    
         
            +
                                        }
         
     | 
| 
      
 45 
     | 
    
         
            +
                                        config.timestamp = timestamp;
         
     | 
| 
      
 46 
     | 
    
         
            +
                                        config.callback(eventName, params);
         
     | 
| 
      
 47 
     | 
    
         
            +
                                    }
         
     | 
| 
      
 48 
     | 
    
         
            +
                                }
         
     | 
| 
      
 49 
     | 
    
         
            +
                            }
         
     | 
| 
      
 50 
     | 
    
         
            +
                        }
         
     | 
| 
      
 51 
     | 
    
         
            +
                        this.startTimer();
         
     | 
| 
      
 52 
     | 
    
         
            +
                    }, 500));
         
     | 
| 
      
 53 
     | 
    
         
            +
                }
         
     | 
| 
      
 54 
     | 
    
         
            +
                static pushWatcher(eventName, callback) {
         
     | 
| 
      
 55 
     | 
    
         
            +
                    let lastConfigs = this.getWatcherConfig()[eventName];
         
     | 
| 
      
 56 
     | 
    
         
            +
                    if (lastConfigs) {
         
     | 
| 
      
 57 
     | 
    
         
            +
                        lastConfigs.push(callback);
         
     | 
| 
      
 58 
     | 
    
         
            +
                    }
         
     | 
| 
      
 59 
     | 
    
         
            +
                    else {
         
     | 
| 
      
 60 
     | 
    
         
            +
                        this.getWatcherConfig()[eventName] = [{
         
     | 
| 
      
 61 
     | 
    
         
            +
                                timestamp: new Date().getTime(),
         
     | 
| 
      
 62 
     | 
    
         
            +
                                callback: callback,
         
     | 
| 
      
 63 
     | 
    
         
            +
                            }];
         
     | 
| 
      
 64 
     | 
    
         
            +
                    }
         
     | 
| 
      
 65 
     | 
    
         
            +
                }
         
     | 
| 
      
 66 
     | 
    
         
            +
                /**
         
     | 
| 
      
 67 
     | 
    
         
            +
                 * 启动一个事件监听器
         
     | 
| 
      
 68 
     | 
    
         
            +
                 * @param eventName 事件名称 string|array
         
     | 
| 
      
 69 
     | 
    
         
            +
                 * @param callback 事件触发的回调  function(eventName,eventParams){}
         
     | 
| 
      
 70 
     | 
    
         
            +
                 */
         
     | 
| 
      
 71 
     | 
    
         
            +
                static startWatcher(eventName, callback) {
         
     | 
| 
      
 72 
     | 
    
         
            +
                    if (!callback || lodash_1.default.isEmpty(eventName)) {
         
     | 
| 
      
 73 
     | 
    
         
            +
                        //未携带回调函数的监听者,认为是无效监听
         
     | 
| 
      
 74 
     | 
    
         
            +
                        return;
         
     | 
| 
      
 75 
     | 
    
         
            +
                    }
         
     | 
| 
      
 76 
     | 
    
         
            +
                    if (lodash_1.default.isArray(eventName)) {
         
     | 
| 
      
 77 
     | 
    
         
            +
                        for (let eventNameElement of eventName) {
         
     | 
| 
      
 78 
     | 
    
         
            +
                            this.pushWatcher(eventNameElement, callback);
         
     | 
| 
      
 79 
     | 
    
         
            +
                        }
         
     | 
| 
      
 80 
     | 
    
         
            +
                    }
         
     | 
| 
      
 81 
     | 
    
         
            +
                    else {
         
     | 
| 
      
 82 
     | 
    
         
            +
                        this.pushWatcher(eventName, callback);
         
     | 
| 
      
 83 
     | 
    
         
            +
                    }
         
     | 
| 
      
 84 
     | 
    
         
            +
                    this.startTimer();
         
     | 
| 
      
 85 
     | 
    
         
            +
                }
         
     | 
| 
      
 86 
     | 
    
         
            +
                /**
         
     | 
| 
      
 87 
     | 
    
         
            +
                 * 通知事件监听者
         
     | 
| 
      
 88 
     | 
    
         
            +
                 * @param eventName 事件名称 string|array
         
     | 
| 
      
 89 
     | 
    
         
            +
                 * @param eventParams 携带参数 any
         
     | 
| 
      
 90 
     | 
    
         
            +
                 */
         
     | 
| 
      
 91 
     | 
    
         
            +
                static notifyWatcher(eventName, eventParams) {
         
     | 
| 
      
 92 
     | 
    
         
            +
                    if (lodash_1.default.isEmpty(eventName)) {
         
     | 
| 
      
 93 
     | 
    
         
            +
                        return;
         
     | 
| 
      
 94 
     | 
    
         
            +
                    }
         
     | 
| 
      
 95 
     | 
    
         
            +
                    if (lodash_1.default.isArray(eventName)) {
         
     | 
| 
      
 96 
     | 
    
         
            +
                        for (let eventNameElement of eventName) {
         
     | 
| 
      
 97 
     | 
    
         
            +
                            js_cookie_1.default.set("EVENT@" + eventNameElement, (new Date().getTime()).toString());
         
     | 
| 
      
 98 
     | 
    
         
            +
                            if (eventParams) {
         
     | 
| 
      
 99 
     | 
    
         
            +
                                js_cookie_1.default.set("EVENT@PARMAS@" + eventNameElement, JSON.stringify(eventParams));
         
     | 
| 
      
 100 
     | 
    
         
            +
                            }
         
     | 
| 
      
 101 
     | 
    
         
            +
                        }
         
     | 
| 
      
 102 
     | 
    
         
            +
                    }
         
     | 
| 
      
 103 
     | 
    
         
            +
                    else {
         
     | 
| 
      
 104 
     | 
    
         
            +
                        js_cookie_1.default.set("EVENT@" + eventName, (new Date().getTime()).toString());
         
     | 
| 
      
 105 
     | 
    
         
            +
                        if (eventParams) {
         
     | 
| 
      
 106 
     | 
    
         
            +
                            js_cookie_1.default.set("EVENT@PARMAS@" + eventName, JSON.stringify(eventParams));
         
     | 
| 
      
 107 
     | 
    
         
            +
                        }
         
     | 
| 
      
 108 
     | 
    
         
            +
                    }
         
     | 
| 
      
 109 
     | 
    
         
            +
                }
         
     | 
| 
      
 110 
     | 
    
         
            +
            }
         
     | 
| 
      
 111 
     | 
    
         
            +
            exports.FastVueMultiWatcher = FastVueMultiWatcher;
         
     | 
| 
         @@ -4,13 +4,13 @@ exports.FastVueMultiConfig = void 0; 
     | 
|
| 
       4 
4 
     | 
    
         
             
            class FastVueMultiConfig {
         
     | 
| 
       5 
5 
     | 
    
         
             
                static getGlobalConfigObj() {
         
     | 
| 
       6 
6 
     | 
    
         
             
                    // @ts-ignore
         
     | 
| 
       7 
     | 
    
         
            -
                    if (!window[" 
     | 
| 
      
 7 
     | 
    
         
            +
                    if (!window["__SYSTEM_GLOBAL_CONFIG"]) {
         
     | 
| 
       8 
8 
     | 
    
         
             
                        //注意:此处变量 SystemGlobalConfig 在 webpack.DefinePlugin  编译后会替换成原始值,所以需要用window对象存储一下
         
     | 
| 
       9 
9 
     | 
    
         
             
                        // @ts-ignore
         
     | 
| 
       10 
     | 
    
         
            -
                        window[" 
     | 
| 
      
 10 
     | 
    
         
            +
                        window["__SYSTEM_GLOBAL_CONFIG"] = SystemGlobalConfig;
         
     | 
| 
       11 
11 
     | 
    
         
             
                    }
         
     | 
| 
       12 
12 
     | 
    
         
             
                    // @ts-ignore
         
     | 
| 
       13 
     | 
    
         
            -
                    return window[" 
     | 
| 
      
 13 
     | 
    
         
            +
                    return window["__SYSTEM_GLOBAL_CONFIG"];
         
     | 
| 
       14 
14 
     | 
    
         
             
                }
         
     | 
| 
       15 
15 
     | 
    
         
             
                /**
         
     | 
| 
       16 
16 
     | 
    
         
             
                 * 获取系统全局变量值
         
     | 
| 
         @@ -11,6 +11,7 @@ import { FastVueMultiElement } from "./other/FastVueMultiElement"; 
     | 
|
| 
       11 
11 
     | 
    
         
             
            import { FastVueMultiWindow } from "./other/FastVueMultiWindow";
         
     | 
| 
       12 
12 
     | 
    
         
             
            import { FastVueMultiFile } from "./other/FastVueMultiFile";
         
     | 
| 
       13 
13 
     | 
    
         
             
            import { FastVueMultiBase64 } from "./other/FastVueMultiBase64";
         
     | 
| 
      
 14 
     | 
    
         
            +
            import { FastVueMultiWatcher } from "./other/FastVueMultiWatcher";
         
     | 
| 
       14 
15 
     | 
    
         
             
            /**
         
     | 
| 
       15 
16 
     | 
    
         
             
             * FastBaseApp 手机APP功能工具类
         
     | 
| 
       16 
17 
     | 
    
         
             
             */
         
     | 
| 
         @@ -71,4 +72,8 @@ export declare class FastVueMultiTool { 
     | 
|
| 
       71 
72 
     | 
    
         
             
                 * base64相关操作
         
     | 
| 
       72 
73 
     | 
    
         
             
                 */
         
     | 
| 
       73 
74 
     | 
    
         
             
                static Base64: typeof FastVueMultiBase64;
         
     | 
| 
      
 75 
     | 
    
         
            +
                /**
         
     | 
| 
      
 76 
     | 
    
         
            +
                 * 监听者
         
     | 
| 
      
 77 
     | 
    
         
            +
                 */
         
     | 
| 
      
 78 
     | 
    
         
            +
                static Watcher: typeof FastVueMultiWatcher;
         
     | 
| 
       74 
79 
     | 
    
         
             
            }
         
     | 
| 
         @@ -1,4 +1,4 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            define(["require", "exports", "tslib", "lodash", "./http/FastVueMultiHttp", "./other/FastVueMultiStore", "./vue/FastVueMultiConfig", "./http/FastVueMultiCookie", "./other/FastVueMultiClipboard", "./other/FastVueMultiDate", "./other/FastVueMultiBoolean", "./other/FastVueMultiFunction", "./other/FastVueMultiElement", "./other/FastVueMultiWindow", "./other/FastVueMultiFile", "./other/FastVueMultiBase64"], function (require, exports, tslib_1, lodash_1, FastVueMultiHttp_1, FastVueMultiStore_1, FastVueMultiConfig_1, FastVueMultiCookie_1, FastVueMultiClipboard_1, FastVueMultiDate_1, FastVueMultiBoolean_1, FastVueMultiFunction_1, FastVueMultiElement_1, FastVueMultiWindow_1, FastVueMultiFile_1, FastVueMultiBase64_1) {
         
     | 
| 
      
 1 
     | 
    
         
            +
            define(["require", "exports", "tslib", "lodash", "./http/FastVueMultiHttp", "./other/FastVueMultiStore", "./vue/FastVueMultiConfig", "./http/FastVueMultiCookie", "./other/FastVueMultiClipboard", "./other/FastVueMultiDate", "./other/FastVueMultiBoolean", "./other/FastVueMultiFunction", "./other/FastVueMultiElement", "./other/FastVueMultiWindow", "./other/FastVueMultiFile", "./other/FastVueMultiBase64", "./other/FastVueMultiWatcher"], function (require, exports, tslib_1, lodash_1, FastVueMultiHttp_1, FastVueMultiStore_1, FastVueMultiConfig_1, FastVueMultiCookie_1, FastVueMultiClipboard_1, FastVueMultiDate_1, FastVueMultiBoolean_1, FastVueMultiFunction_1, FastVueMultiElement_1, FastVueMultiWindow_1, FastVueMultiFile_1, FastVueMultiBase64_1, FastVueMultiWatcher_1) {
         
     | 
| 
       2 
2 
     | 
    
         
             
                "use strict";
         
     | 
| 
       3 
3 
     | 
    
         
             
                Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
       4 
4 
     | 
    
         
             
                exports.FastVueMultiTool = void 0;
         
     | 
| 
         @@ -65,6 +65,10 @@ define(["require", "exports", "tslib", "lodash", "./http/FastVueMultiHttp", "./o 
     | 
|
| 
       65 
65 
     | 
    
         
             
                     * base64相关操作
         
     | 
| 
       66 
66 
     | 
    
         
             
                     */
         
     | 
| 
       67 
67 
     | 
    
         
             
                    FastVueMultiTool.Base64 = FastVueMultiBase64_1.FastVueMultiBase64;
         
     | 
| 
      
 68 
     | 
    
         
            +
                    /**
         
     | 
| 
      
 69 
     | 
    
         
            +
                     * 监听者
         
     | 
| 
      
 70 
     | 
    
         
            +
                     */
         
     | 
| 
      
 71 
     | 
    
         
            +
                    FastVueMultiTool.Watcher = FastVueMultiWatcher_1.FastVueMultiWatcher;
         
     | 
| 
       68 
72 
     | 
    
         
             
                    return FastVueMultiTool;
         
     | 
| 
       69 
73 
     | 
    
         
             
                }());
         
     | 
| 
       70 
74 
     | 
    
         
             
                exports.FastVueMultiTool = FastVueMultiTool;
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            /**
         
     | 
| 
      
 2 
     | 
    
         
            +
             * 事件监听器
         
     | 
| 
      
 3 
     | 
    
         
            +
             */
         
     | 
| 
      
 4 
     | 
    
         
            +
            export declare class FastVueMultiWatcher {
         
     | 
| 
      
 5 
     | 
    
         
            +
                private static getWatcherConfig;
         
     | 
| 
      
 6 
     | 
    
         
            +
                private static getWatcherTimer;
         
     | 
| 
      
 7 
     | 
    
         
            +
                private static setWatcherTimer;
         
     | 
| 
      
 8 
     | 
    
         
            +
                private static stopWatcherTimer;
         
     | 
| 
      
 9 
     | 
    
         
            +
                private static startTimer;
         
     | 
| 
      
 10 
     | 
    
         
            +
                private static pushWatcher;
         
     | 
| 
      
 11 
     | 
    
         
            +
                /**
         
     | 
| 
      
 12 
     | 
    
         
            +
                 * 启动一个事件监听器
         
     | 
| 
      
 13 
     | 
    
         
            +
                 * @param eventName 事件名称 string|array
         
     | 
| 
      
 14 
     | 
    
         
            +
                 * @param callback 事件触发的回调  function(eventName,eventParams){}
         
     | 
| 
      
 15 
     | 
    
         
            +
                 */
         
     | 
| 
      
 16 
     | 
    
         
            +
                static startWatcher(eventName: any, callback: any): void;
         
     | 
| 
      
 17 
     | 
    
         
            +
                /**
         
     | 
| 
      
 18 
     | 
    
         
            +
                 * 通知事件监听者
         
     | 
| 
      
 19 
     | 
    
         
            +
                 * @param eventName 事件名称 string|array
         
     | 
| 
      
 20 
     | 
    
         
            +
                 * @param eventParams 携带参数 any
         
     | 
| 
      
 21 
     | 
    
         
            +
                 */
         
     | 
| 
      
 22 
     | 
    
         
            +
                static notifyWatcher(eventName: any, eventParams?: any): void;
         
     | 
| 
      
 23 
     | 
    
         
            +
            }
         
     | 
| 
         @@ -0,0 +1,119 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            define(["require", "exports", "tslib", "lodash", "js-cookie"], function (require, exports, tslib_1, lodash_1, js_cookie_1) {
         
     | 
| 
      
 2 
     | 
    
         
            +
                "use strict";
         
     | 
| 
      
 3 
     | 
    
         
            +
                Object.defineProperty(exports, "__esModule", { value: true });
         
     | 
| 
      
 4 
     | 
    
         
            +
                exports.FastVueMultiWatcher = void 0;
         
     | 
| 
      
 5 
     | 
    
         
            +
                lodash_1 = tslib_1.__importDefault(lodash_1);
         
     | 
| 
      
 6 
     | 
    
         
            +
                js_cookie_1 = tslib_1.__importDefault(js_cookie_1);
         
     | 
| 
      
 7 
     | 
    
         
            +
                /**
         
     | 
| 
      
 8 
     | 
    
         
            +
                 * 事件监听器
         
     | 
| 
      
 9 
     | 
    
         
            +
                 */
         
     | 
| 
      
 10 
     | 
    
         
            +
                var FastVueMultiWatcher = /** @class */ (function () {
         
     | 
| 
      
 11 
     | 
    
         
            +
                    function FastVueMultiWatcher() {
         
     | 
| 
      
 12 
     | 
    
         
            +
                    }
         
     | 
| 
      
 13 
     | 
    
         
            +
                    FastVueMultiWatcher.getWatcherConfig = function () {
         
     | 
| 
      
 14 
     | 
    
         
            +
                        if (!window["__WATCHER_CONFIG"]) {
         
     | 
| 
      
 15 
     | 
    
         
            +
                            window["__WATCHER_CONFIG"] = {};
         
     | 
| 
      
 16 
     | 
    
         
            +
                        }
         
     | 
| 
      
 17 
     | 
    
         
            +
                        return window["__WATCHER_CONFIG"];
         
     | 
| 
      
 18 
     | 
    
         
            +
                    };
         
     | 
| 
      
 19 
     | 
    
         
            +
                    FastVueMultiWatcher.getWatcherTimer = function () {
         
     | 
| 
      
 20 
     | 
    
         
            +
                        return window["__WATCHER_TIMER"];
         
     | 
| 
      
 21 
     | 
    
         
            +
                    };
         
     | 
| 
      
 22 
     | 
    
         
            +
                    FastVueMultiWatcher.setWatcherTimer = function (timer) {
         
     | 
| 
      
 23 
     | 
    
         
            +
                        window["__WATCHER_TIMER"] = timer;
         
     | 
| 
      
 24 
     | 
    
         
            +
                    };
         
     | 
| 
      
 25 
     | 
    
         
            +
                    FastVueMultiWatcher.stopWatcherTimer = function () {
         
     | 
| 
      
 26 
     | 
    
         
            +
                        if (this.getWatcherTimer()) {
         
     | 
| 
      
 27 
     | 
    
         
            +
                            clearTimeout(this.getWatcherTimer());
         
     | 
| 
      
 28 
     | 
    
         
            +
                        }
         
     | 
| 
      
 29 
     | 
    
         
            +
                    };
         
     | 
| 
      
 30 
     | 
    
         
            +
                    FastVueMultiWatcher.startTimer = function () {
         
     | 
| 
      
 31 
     | 
    
         
            +
                        var _this = this;
         
     | 
| 
      
 32 
     | 
    
         
            +
                        this.stopWatcherTimer();
         
     | 
| 
      
 33 
     | 
    
         
            +
                        this.setWatcherTimer(setTimeout(function () {
         
     | 
| 
      
 34 
     | 
    
         
            +
                            for (var eventName in _this.getWatcherConfig()) {
         
     | 
| 
      
 35 
     | 
    
         
            +
                                var watchValue = js_cookie_1.default.get("EVENT@" + eventName);
         
     | 
| 
      
 36 
     | 
    
         
            +
                                var configs = _this.getWatcherConfig()[eventName];
         
     | 
| 
      
 37 
     | 
    
         
            +
                                for (var _i = 0, configs_1 = configs; _i < configs_1.length; _i++) {
         
     | 
| 
      
 38 
     | 
    
         
            +
                                    var config = configs_1[_i];
         
     | 
| 
      
 39 
     | 
    
         
            +
                                    if (watchValue !== null && watchValue !== undefined && watchValue !== "null" && watchValue !== "undefined") {
         
     | 
| 
      
 40 
     | 
    
         
            +
                                        var timestamp = parseInt(watchValue);
         
     | 
| 
      
 41 
     | 
    
         
            +
                                        if (isNaN(timestamp)) {
         
     | 
| 
      
 42 
     | 
    
         
            +
                                            continue;
         
     | 
| 
      
 43 
     | 
    
         
            +
                                        }
         
     | 
| 
      
 44 
     | 
    
         
            +
                                        if (config.timestamp < timestamp) {
         
     | 
| 
      
 45 
     | 
    
         
            +
                                            var params = js_cookie_1.default.get("EVENT@PARMAS@" + eventName);
         
     | 
| 
      
 46 
     | 
    
         
            +
                                            if (params) {
         
     | 
| 
      
 47 
     | 
    
         
            +
                                                params = JSON.parse(params);
         
     | 
| 
      
 48 
     | 
    
         
            +
                                            }
         
     | 
| 
      
 49 
     | 
    
         
            +
                                            config.timestamp = timestamp;
         
     | 
| 
      
 50 
     | 
    
         
            +
                                            config.callback(eventName, params);
         
     | 
| 
      
 51 
     | 
    
         
            +
                                        }
         
     | 
| 
      
 52 
     | 
    
         
            +
                                    }
         
     | 
| 
      
 53 
     | 
    
         
            +
                                }
         
     | 
| 
      
 54 
     | 
    
         
            +
                            }
         
     | 
| 
      
 55 
     | 
    
         
            +
                            _this.startTimer();
         
     | 
| 
      
 56 
     | 
    
         
            +
                        }, 500));
         
     | 
| 
      
 57 
     | 
    
         
            +
                    };
         
     | 
| 
      
 58 
     | 
    
         
            +
                    FastVueMultiWatcher.pushWatcher = function (eventName, callback) {
         
     | 
| 
      
 59 
     | 
    
         
            +
                        var lastConfigs = this.getWatcherConfig()[eventName];
         
     | 
| 
      
 60 
     | 
    
         
            +
                        if (lastConfigs) {
         
     | 
| 
      
 61 
     | 
    
         
            +
                            lastConfigs.push(callback);
         
     | 
| 
      
 62 
     | 
    
         
            +
                        }
         
     | 
| 
      
 63 
     | 
    
         
            +
                        else {
         
     | 
| 
      
 64 
     | 
    
         
            +
                            this.getWatcherConfig()[eventName] = [{
         
     | 
| 
      
 65 
     | 
    
         
            +
                                    timestamp: new Date().getTime(),
         
     | 
| 
      
 66 
     | 
    
         
            +
                                    callback: callback,
         
     | 
| 
      
 67 
     | 
    
         
            +
                                }];
         
     | 
| 
      
 68 
     | 
    
         
            +
                        }
         
     | 
| 
      
 69 
     | 
    
         
            +
                    };
         
     | 
| 
      
 70 
     | 
    
         
            +
                    /**
         
     | 
| 
      
 71 
     | 
    
         
            +
                     * 启动一个事件监听器
         
     | 
| 
      
 72 
     | 
    
         
            +
                     * @param eventName 事件名称 string|array
         
     | 
| 
      
 73 
     | 
    
         
            +
                     * @param callback 事件触发的回调  function(eventName,eventParams){}
         
     | 
| 
      
 74 
     | 
    
         
            +
                     */
         
     | 
| 
      
 75 
     | 
    
         
            +
                    FastVueMultiWatcher.startWatcher = function (eventName, callback) {
         
     | 
| 
      
 76 
     | 
    
         
            +
                        if (!callback || lodash_1.default.isEmpty(eventName)) {
         
     | 
| 
      
 77 
     | 
    
         
            +
                            //未携带回调函数的监听者,认为是无效监听
         
     | 
| 
      
 78 
     | 
    
         
            +
                            return;
         
     | 
| 
      
 79 
     | 
    
         
            +
                        }
         
     | 
| 
      
 80 
     | 
    
         
            +
                        if (lodash_1.default.isArray(eventName)) {
         
     | 
| 
      
 81 
     | 
    
         
            +
                            for (var _i = 0, eventName_1 = eventName; _i < eventName_1.length; _i++) {
         
     | 
| 
      
 82 
     | 
    
         
            +
                                var eventNameElement = eventName_1[_i];
         
     | 
| 
      
 83 
     | 
    
         
            +
                                this.pushWatcher(eventNameElement, callback);
         
     | 
| 
      
 84 
     | 
    
         
            +
                            }
         
     | 
| 
      
 85 
     | 
    
         
            +
                        }
         
     | 
| 
      
 86 
     | 
    
         
            +
                        else {
         
     | 
| 
      
 87 
     | 
    
         
            +
                            this.pushWatcher(eventName, callback);
         
     | 
| 
      
 88 
     | 
    
         
            +
                        }
         
     | 
| 
      
 89 
     | 
    
         
            +
                        this.startTimer();
         
     | 
| 
      
 90 
     | 
    
         
            +
                    };
         
     | 
| 
      
 91 
     | 
    
         
            +
                    /**
         
     | 
| 
      
 92 
     | 
    
         
            +
                     * 通知事件监听者
         
     | 
| 
      
 93 
     | 
    
         
            +
                     * @param eventName 事件名称 string|array
         
     | 
| 
      
 94 
     | 
    
         
            +
                     * @param eventParams 携带参数 any
         
     | 
| 
      
 95 
     | 
    
         
            +
                     */
         
     | 
| 
      
 96 
     | 
    
         
            +
                    FastVueMultiWatcher.notifyWatcher = function (eventName, eventParams) {
         
     | 
| 
      
 97 
     | 
    
         
            +
                        if (lodash_1.default.isEmpty(eventName)) {
         
     | 
| 
      
 98 
     | 
    
         
            +
                            return;
         
     | 
| 
      
 99 
     | 
    
         
            +
                        }
         
     | 
| 
      
 100 
     | 
    
         
            +
                        if (lodash_1.default.isArray(eventName)) {
         
     | 
| 
      
 101 
     | 
    
         
            +
                            for (var _i = 0, eventName_2 = eventName; _i < eventName_2.length; _i++) {
         
     | 
| 
      
 102 
     | 
    
         
            +
                                var eventNameElement = eventName_2[_i];
         
     | 
| 
      
 103 
     | 
    
         
            +
                                js_cookie_1.default.set("EVENT@" + eventNameElement, (new Date().getTime()).toString());
         
     | 
| 
      
 104 
     | 
    
         
            +
                                if (eventParams) {
         
     | 
| 
      
 105 
     | 
    
         
            +
                                    js_cookie_1.default.set("EVENT@PARMAS@" + eventNameElement, JSON.stringify(eventParams));
         
     | 
| 
      
 106 
     | 
    
         
            +
                                }
         
     | 
| 
      
 107 
     | 
    
         
            +
                            }
         
     | 
| 
      
 108 
     | 
    
         
            +
                        }
         
     | 
| 
      
 109 
     | 
    
         
            +
                        else {
         
     | 
| 
      
 110 
     | 
    
         
            +
                            js_cookie_1.default.set("EVENT@" + eventName, (new Date().getTime()).toString());
         
     | 
| 
      
 111 
     | 
    
         
            +
                            if (eventParams) {
         
     | 
| 
      
 112 
     | 
    
         
            +
                                js_cookie_1.default.set("EVENT@PARMAS@" + eventName, JSON.stringify(eventParams));
         
     | 
| 
      
 113 
     | 
    
         
            +
                            }
         
     | 
| 
      
 114 
     | 
    
         
            +
                        }
         
     | 
| 
      
 115 
     | 
    
         
            +
                    };
         
     | 
| 
      
 116 
     | 
    
         
            +
                    return FastVueMultiWatcher;
         
     | 
| 
      
 117 
     | 
    
         
            +
                }());
         
     | 
| 
      
 118 
     | 
    
         
            +
                exports.FastVueMultiWatcher = FastVueMultiWatcher;
         
     | 
| 
      
 119 
     | 
    
         
            +
            });
         
     | 
| 
         @@ -7,13 +7,13 @@ define(["require", "exports"], function (require, exports) { 
     | 
|
| 
       7 
7 
     | 
    
         
             
                    }
         
     | 
| 
       8 
8 
     | 
    
         
             
                    FastVueMultiConfig.getGlobalConfigObj = function () {
         
     | 
| 
       9 
9 
     | 
    
         
             
                        // @ts-ignore
         
     | 
| 
       10 
     | 
    
         
            -
                        if (!window[" 
     | 
| 
      
 10 
     | 
    
         
            +
                        if (!window["__SYSTEM_GLOBAL_CONFIG"]) {
         
     | 
| 
       11 
11 
     | 
    
         
             
                            //注意:此处变量 SystemGlobalConfig 在 webpack.DefinePlugin  编译后会替换成原始值,所以需要用window对象存储一下
         
     | 
| 
       12 
12 
     | 
    
         
             
                            // @ts-ignore
         
     | 
| 
       13 
     | 
    
         
            -
                            window[" 
     | 
| 
      
 13 
     | 
    
         
            +
                            window["__SYSTEM_GLOBAL_CONFIG"] = SystemGlobalConfig;
         
     | 
| 
       14 
14 
     | 
    
         
             
                        }
         
     | 
| 
       15 
15 
     | 
    
         
             
                        // @ts-ignore
         
     | 
| 
       16 
     | 
    
         
            -
                        return window[" 
     | 
| 
      
 16 
     | 
    
         
            +
                        return window["__SYSTEM_GLOBAL_CONFIG"];
         
     | 
| 
       17 
17 
     | 
    
         
             
                    };
         
     | 
| 
       18 
18 
     | 
    
         
             
                    /**
         
     | 
| 
       19 
19 
     | 
    
         
             
                     * 获取系统全局变量值
         
     | 
    
        package/package.json
    CHANGED
    
    
| 
         @@ -4,13 +4,13 @@ exports.FastVueMultiConfig = void 0; 
     | 
|
| 
       4 
4 
     | 
    
         
             
            class FastVueMultiConfig {
         
     | 
| 
       5 
5 
     | 
    
         
             
                static getGlobalConfigObj() {
         
     | 
| 
       6 
6 
     | 
    
         
             
                    // @ts-ignore
         
     | 
| 
       7 
     | 
    
         
            -
                    if (!window[" 
     | 
| 
      
 7 
     | 
    
         
            +
                    if (!window["__SYSTEM_GLOBAL_CONFIG"]) {
         
     | 
| 
       8 
8 
     | 
    
         
             
                        //注意:此处变量 SystemGlobalConfig 在 webpack.DefinePlugin  编译后会替换成原始值,所以需要用window对象存储一下
         
     | 
| 
       9 
9 
     | 
    
         
             
                        // @ts-ignore
         
     | 
| 
       10 
     | 
    
         
            -
                        window[" 
     | 
| 
      
 10 
     | 
    
         
            +
                        window["__SYSTEM_GLOBAL_CONFIG"] = SystemGlobalConfig;
         
     | 
| 
       11 
11 
     | 
    
         
             
                    }
         
     | 
| 
       12 
12 
     | 
    
         
             
                    // @ts-ignore
         
     | 
| 
       13 
     | 
    
         
            -
                    return window[" 
     | 
| 
      
 13 
     | 
    
         
            +
                    return window["__SYSTEM_GLOBAL_CONFIG"];
         
     | 
| 
       14 
14 
     | 
    
         
             
                }
         
     | 
| 
       15 
15 
     | 
    
         
             
                /**
         
     | 
| 
       16 
16 
     | 
    
         
             
                 * 获取系统全局变量值
         
     |