xframelib 1.0.2 → 1.0.3

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.
@@ -161,10 +161,10 @@
161
161
  return sw.postMessage(data, transferable);
162
162
  }
163
163
 
164
- if (window.opener) {
164
+ if (globalThis.opener) {
165
165
  // The opener can't listen to onload event, so we need to help em out!
166
166
  // (telling them that we are ready to accept postMessage's)
167
- window.opener.postMessage('StreamSaver::loadedPopup', '*');
167
+ globalThis.opener.postMessage('StreamSaver::loadedPopup', '*');
168
168
  }
169
169
 
170
170
  if (navigator.serviceWorker) {
@@ -0,0 +1,72 @@
1
+ import { LRUCache } from 'lru-cache';
2
+ declare class WebCacheTool {
3
+ static defaultOptions: {
4
+ max: number;
5
+ maxAge: number;
6
+ };
7
+ /**
8
+ * 当前默认集合对象
9
+ */
10
+ static readonly cache: LRUCache<{}, {}, unknown>;
11
+ static createCache(options?: any): LRUCache<{}, {}, unknown>;
12
+ /**
13
+ * 加入缓存
14
+ * @param key
15
+ * @param value
16
+ * @param cacheObj
17
+ * @returns
18
+ */
19
+ static set(key: string, value: any, cacheObj?: any): void;
20
+ /**
21
+ * 获取某个缓存值
22
+ * @param key
23
+ * @param cacheObj
24
+ * @returns
25
+ */
26
+ static get(key: string, cacheObj?: any): any;
27
+ /**
28
+ * 删除某KEY的缓存
29
+ * @param key
30
+ * @param cacheObj
31
+ * @returns
32
+ */
33
+ static remove(key: string, cacheObj?: any): boolean;
34
+ /**
35
+ * 是否包含某个KEY
36
+ * @param key
37
+ * @param cacheObj
38
+ * @returns
39
+ */
40
+ static has(key: string, cacheObj?: any): boolean;
41
+ /**
42
+ * 获取已经存储的个数
43
+ * @param cacheObj
44
+ * @returns
45
+ */
46
+ static count(cacheObj?: any): number;
47
+ /**
48
+ * 最大数量
49
+ * @param cacheObj
50
+ * @returns
51
+ */
52
+ static maxSize(cacheObj?: any): number;
53
+ /**
54
+ * 获取缓存,但不更新时间
55
+ * @param key
56
+ * @param cacheObj
57
+ * @returns
58
+ */
59
+ static peek(key: string, cacheObj?: any): any;
60
+ /**
61
+ * 返回所有键集合
62
+ * @param cacheObj
63
+ * @returns
64
+ */
65
+ static keys(cacheObj?: any): Generator<any, void, unknown>;
66
+ /**
67
+ * 清空缓存
68
+ * @param cacheObj
69
+ */
70
+ static clear(cacheObj?: any): void;
71
+ }
72
+ export default WebCacheTool;
@@ -9,6 +9,7 @@ import { default as XXTEA } from './XXTEA';
9
9
  import { default as WaterMark } from './WaterMark';
10
10
  import { GetSignalRClient } from './SignalrClient';
11
11
  import { default as iconv } from 'iconv-lite';
12
+ import { default as WebCacheTool } from './WebCacheTool';
12
13
  export * from './Color';
13
14
  export * from './FileDownload';
14
15
  export * from './Time';
@@ -26,4 +27,4 @@ export * from './WidgetsTool';
26
27
  export * from './CommonTool';
27
28
  export * from './FilenameUtils';
28
29
  export * from './AutoUpdate';
29
- export { iconv, GetSignalRClient, WaterMark, XXTEA, H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid, ZipTool, GzipTool, DayjsTool };
30
+ export { iconv, GetSignalRClient, WaterMark, XXTEA, H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid, ZipTool, GzipTool, DayjsTool, WebCacheTool };
@@ -10,4 +10,10 @@ declare const xxteaWorker: {
10
10
  declare const xmathWorker: {
11
11
  readonly [x: number]: Worker;
12
12
  } & import('comlink').RemoteObject<typeof import("./worker-xmath")> & import('comlink').ProxyMethods;
13
- export { xmathWorker, xxteaWorker };
13
+ /**
14
+ * 前端缓存层-webworker
15
+ */
16
+ declare const webCacheWorker: {
17
+ readonly [x: number]: Worker;
18
+ } & import('comlink').RemoteObject<typeof import("./worker-webcache")> & import('comlink').ProxyMethods;
19
+ export { xmathWorker, xxteaWorker, webCacheWorker };
@@ -0,0 +1,13 @@
1
+ import { LRUCache } from 'lru-cache';
2
+ declare function createCache(cacheKey: string, options?: any): Promise<LRUCache<{}, {}, unknown>>;
3
+ declare function getCacheObject(cacheObjKey?: string): Promise<LRUCache<any, any, unknown> | undefined>;
4
+ declare function set(key: string, value: any, cacheObjKey?: string): Promise<boolean>;
5
+ declare function get(key: string, cacheObjKey?: string): Promise<any>;
6
+ declare function remove(key: string, cacheObjKey?: string): Promise<boolean | undefined>;
7
+ declare function has(key: string, cacheObjKey?: string): Promise<boolean>;
8
+ declare function count(cacheObjKey?: string): Promise<number>;
9
+ declare function maxSize(cacheObjKey?: string): Promise<number>;
10
+ declare function peek(key: string, cacheObjKey?: string): Promise<any>;
11
+ declare function clear(cacheObjKey?: string): Promise<boolean>;
12
+ declare function keys(cacheObjKey?: string): Promise<Generator<any, void, unknown> | undefined>;
13
+ export { clear, count, maxSize, createCache, get, getCacheObject, has, keys, peek, remove, set, };
@@ -0,0 +1,3 @@
1
+ declare function initWorker(worker: Worker): void;
2
+ declare function runtask(worker: Worker, op: any, args: any): Promise<unknown>;
3
+ export { initWorker, runtask };
@@ -0,0 +1,9 @@
1
+ import { initWorker } from './frontWorker';
2
+ /**
3
+ * 注册 webworker的相关方法
4
+ * @param components Webworker Service的相关方法
5
+ * @param worker
6
+ * @returns
7
+ */
8
+ declare function registerWorkerSerivces(components: Record<string, unknown>, worker: Worker): any;
9
+ export { initWorker, registerWorkerSerivces };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xframelib",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "积累的前端开发基础库,来源于项目,服务于项目。",
5
5
  "main": "dist/index.js",
6
6
  "common": "dist/index.cjs",
@@ -32,12 +32,13 @@
32
32
  "@hprose/rpc-html5": "^3.0.10",
33
33
  "@iconify-icons/ant-design": "^1.2.7",
34
34
  "@iconify/vue": "^5.0.0",
35
- "@microsoft/signalr": "^8.0.7",
36
- "axios": "^1.10.0",
35
+ "@microsoft/signalr": "^9.0.6",
36
+ "axios": "^1.11.0",
37
37
  "fflate": "^0.8.2",
38
38
  "iconv-lite": "^0.6.3",
39
39
  "localforage": "^1.10.0",
40
40
  "loglevel": "^1.9.2",
41
+ "lru-cache": "^11.1.0",
41
42
  "qs": "^6.14.0",
42
43
  "spark-md5": "^3.0.2",
43
44
  "xhr": "^2.6.0"
@@ -49,22 +50,22 @@
49
50
  "@rollup/plugin-node-resolve": "^16.0.1",
50
51
  "@rollup/plugin-terser": "^0.4.4",
51
52
  "@rollup/plugin-typescript": "^12.1.4",
52
- "@vitejs/plugin-vue": "^6.0.0",
53
- "esbuild": "^0.25.6",
53
+ "@vitejs/plugin-vue": "^6.0.1",
54
+ "esbuild": "^0.25.8",
54
55
  "rollup-plugin-copy": "^3.5.0",
55
56
  "rollup-plugin-esbuild": "^6.2.1",
56
57
  "rollup-plugin-scss": "^4.0.1",
57
58
  "rollup-plugin-typescript2": "^0.36.0",
58
59
  "rollup-plugin-vue": "^6.0.0",
59
- "sass": "^1.89.2",
60
- "typescript": "^5.8.3",
61
- "vite": "^7.0.4",
62
- "vite-plugin-comlink": "^5.1.0",
60
+ "sass": "^1.90.0",
61
+ "typescript": "^5.9.2",
62
+ "vite": "^7.1.1",
63
+ "vite-plugin-comlink": "^5.3.0",
63
64
  "vite-plugin-commonjs": "^0.10.4",
64
65
  "vite-plugin-dts": "^4.5.4",
65
66
  "vite-plugin-node-polyfills": "^0.24.0",
66
- "vite-plugin-static-copy": "^3.1.0",
67
- "vue": "^3.5.17",
67
+ "vite-plugin-static-copy": "^3.1.1",
68
+ "vue": "^3.5.18",
68
69
  "vue-router": "^4.5.1"
69
70
  }
70
71
  }