@bestime/utils_browser 1.0.1 → 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.
@@ -6,6 +6,140 @@ declare function getWindowSize(): {
6
6
  height: number;
7
7
  };
8
8
 
9
+ /**
10
+ * 监听DOM尺寸变化
11
+ * @param element - dom元素
12
+ * @param handler - 变换回调函数
13
+ * @param type - 监听类型。默认width+height
14
+ * @param interval - 多久检查一次。默认值:500
15
+ * @returns 销毁方法
16
+ *
17
+ */
18
+ declare function observeDomResize(
19
+ element: HTMLElement,
20
+ handler: (element: HTMLElement) => void,
21
+ type?: ('width' | 'height' | 'position')[],
22
+ interval?: number
23
+ ): () => void;
24
+
25
+ /**
26
+ * 下载 url 文件
27
+ * @param url - 文件地址
28
+ * @param fileName - 文件名
29
+ */
30
+ declare function downloadFileByUrl(url: string, fileName: string): void;
31
+
32
+ /**
33
+ * 下载ArrayBuffer文件
34
+ * @param data - ArrayBuffer格式的数据
35
+ * @param fileName - 文件名
36
+ */
37
+ declare function downloadFileByArrayBuffer(data: ArrayBuffer, fileName: string): void;
38
+
39
+ /**
40
+ * 移除Dom节点
41
+ * @param dom - 待移除的dom元素
42
+ */
43
+ declare function removeElement(el: HTMLElement): void;
44
+
45
+ /**
46
+ * 移除Dom节点
47
+ * @param ev - 事件
48
+ * @param bubble - 阻止冒泡. 默认 true
49
+ * @param stop - 阻止穿透. 默认 true
50
+ */
51
+ declare function prevent(ev: Event, bubble: boolean, stop: boolean): void;
52
+
53
+ /**
54
+ * @param key - 获取的键
55
+ * @returns 保存的值
56
+ */
57
+ declare function getStorage(key: string): string;
58
+
59
+ /**
60
+ * @param key - 删除的键
61
+ * @returns 保存的值
62
+ */
63
+ declare function removeStorage(key: string): void;
64
+
65
+ /**
66
+ * 设置localstorage
67
+ * @param key - 保存的键
68
+ * @param value - 保存的值
69
+ */
70
+ declare function setStorage(key: string, value: any): void;
71
+
72
+ /**
73
+ * 获取dom相对位置
74
+ * @param el - dom
75
+ * @returns 信息
76
+ */
77
+ declare function getRelativePos(el: HTMLElement): {
78
+ x: number;
79
+ y: number;
80
+ height: number;
81
+ width: number;
82
+ clientWidth: number;
83
+ clientHeight: number;
84
+ };
85
+
86
+ /**
87
+ * 获取当前js所在路径
88
+ * @param tir - 向上取几级目录,默认0,当前目录
89
+ * @returns 相对路径
90
+ */
91
+ declare function getJsFileBaseUrl(tir: number): string;
92
+
93
+ interface LibraryFileConfig {
94
+ type: 'js' | 'css';
95
+ url: string;
96
+ module: string;
97
+ dependencies?: LibraryFileConfig[];
98
+ with?: LibraryFileConfig[];
99
+ attribute?: Record<string, string>;
100
+ }
101
+ type SuccessCallback = (...args: any[]) => void;
102
+ /**
103
+ * js和css文件加载器
104
+ * @param files - 文件配置
105
+ * @param callback - 加载成功回调
106
+ */
107
+ declare function libraryFile(
108
+ files: LibraryFileConfig | LibraryFileConfig[],
109
+ callback: SuccessCallback
110
+ ): void;
111
+
112
+ /**
113
+ * 设置cookie。默认path="/"
114
+ * @param key - 设置的键名
115
+ * @param value - 设置的值
116
+ * @param expiredTime - 单位(毫秒)
117
+ */
118
+ declare function setCookie(key: string, value: string, expiredTime?: number): void;
119
+
120
+ /**
121
+ * @param key - 获取的键
122
+ * @param target - 来源,默认document.cookie
123
+ * @returns 保存的值
124
+ */
125
+ declare function getCookie(key: string, target?: string): string;
126
+
127
+ /**
128
+ * 删除cookie
129
+ *
130
+ * @param key - 键名
131
+ */
132
+ declare function removeCookie(key: string): void;
133
+
134
+ /**
135
+ * 给dom元素添加className
136
+ * @param el - DOM
137
+ * @param from - 将要被替换的className
138
+ * @param to - 替换为
139
+ * @returns
140
+ */
141
+ declare function toggleClass(el: HTMLElement, from: string | string[], to: string | string[]): void;
142
+
9
143
  /**
10
144
  * 给dom元素添加className
11
145
  * @param el - DOM
@@ -14,6 +148,33 @@ declare function getWindowSize(): {
14
148
  */
15
149
  declare function addClass(el: HTMLElement, name: string | string[]): void;
16
150
 
17
- export { addClass, getWindowSize };
151
+ /**
152
+ * 给dom元素移除className
153
+ * @param el - DOM
154
+ * @param name - 需要添加的className
155
+ * @returns
156
+ */
157
+ declare function removeClass(el: HTMLElement, name: string | string[]): void;
158
+
159
+ export {
160
+ addClass,
161
+ downloadFileByArrayBuffer,
162
+ downloadFileByUrl,
163
+ getCookie,
164
+ getJsFileBaseUrl,
165
+ getRelativePos,
166
+ getStorage,
167
+ getWindowSize,
168
+ libraryFile,
169
+ observeDomResize,
170
+ prevent,
171
+ removeClass,
172
+ removeCookie,
173
+ removeElement,
174
+ removeStorage,
175
+ setCookie,
176
+ setStorage,
177
+ toggleClass
178
+ };
18
179
 
19
180
  export default undefined;
@@ -3,6 +3,6 @@
3
3
  * @QQ 1174295440
4
4
  * @author Bestime
5
5
  * @see https://github.com/bestime/tool
6
- * @update 2023-11-05 11:41:51
6
+ * @update 2023-11-08 22:15:57
7
7
  */
8
- import{isArray,forEach}from"@bestime/utils_base";function getWindowSize(){return{width:document.documentElement.clientWidth||document.body.clientWidth||window.innerWidth||0,height:document.documentElement.clientHeight||document.body.clientHeight||window.innerHeight||0}}function addClass(i,t){isArray(t)?forEach(t,function(t){i.classList.add(t)}):i.classList.add(t)}export{addClass,getWindowSize};
8
+ import{defaultValue,isString,variableHasValue,isArray,forEach}from"@bestime/utils_base";function getWindowSize(){return{width:document.documentElement.clientWidth||document.body.clientWidth||window.innerWidth||0,height:document.documentElement.clientHeight||document.body.clientHeight||window.innerHeight||0}}var timer,htivId=0,idName="",isStart=!1,records={};function stop(){isStart=!1,clearInterval(timer),timer=undefined}function startRun(){clearInterval(timer),isStart=!0,timer=setInterval(function(){for(var e in records){var t=records[e];t.current=+new Date,t.current-t.start>=t.interval&&(t.start=t.current,records[e].handler())}},17)}function add(e,t){return idName="HI-"+ ++htivId,records[idName]={start:+new Date,current:0,handler:e,interval:t},isStart||startRun(),idName}function remove(e){delete records[e],0===Object.keys(records).length&&stop()}var hpInterval={add:add,remove:remove};function observeDomResize(n,o,r,e){var i=[0,0,!1],l=[0,0,!1],a=[0,0,!1],d=[0,0,!1],t=hpInterval.add(c,e=e||500);function c(){var e,t;document.body.contains(n)?(e=!1,null!=r&&r.includes("position")&&(t=n.getBoundingClientRect(),a[0]=t.left,a[2]=a[0]!==a[1],d[0]=t.top,d[2]=d[0]!==d[1]),i[0]=n.offsetWidth,i[2]=i[0]!==i[1],l[0]=n.offsetHeight,l[2]=l[0]!==l[1],i[2]&&(i[1]=i[0],null!=r&&r.includes("width")&&(e=!0)),l[2]&&(l[1]=l[0],null!=r&&r.includes("height")&&(e=!0)),(d[2]||a[2])&&(d[1]=d[0],a[1]=a[0],null!=r&&r.includes("position")&&(e=!0)),r&&0!==r.length||(i[2]||l[2]||d[2]||a[2])&&(e=!0),e&&o(n)):s()}function s(){hpInterval.remove(t),i=undefined,l=undefined}return c(),s}function downloadFileByUrl(e,t){var n=document.createElement("a");n.style.display="none",n.download=t,n.setAttribute("href",e),n.setAttribute("target","_blank"),n.setAttribute("download",t),document.body.appendChild(n),n.click(),n.remove()}var $undefinedValue=void 0,$decodeURIComponent=decodeURIComponent,$browserGlobal=window,$headElement=document.getElementsByTagName("head")[0];function downloadFileByArrayBuffer(e,t){var n=$browserGlobal.URL,e=n.createObjectURL(new Blob([e]));downloadFileByUrl(e,t),n.revokeObjectURL(e),undefined}function removeElement(e){e.parentNode&&e.parentNode.removeChild(e)}function prevent(e,t,n){e=e||$browserGlobal.event,n=!1!==n,(t=!1!==t)&&$browserGlobal.event?$browserGlobal.event.cancelBubble=!0:e.stopPropagation(),n&&$browserGlobal.event?$browserGlobal.event.returnValue=!1:e.preventDefault()}function getStorage(e){e=localStorage.getItem(e);return defaultValue(e,"")}function removeStorage(e){localStorage.removeItem(e)}function hpSetStringValue(e){return e=isString(e)?e:JSON.stringify(e)}function setStorage(e,t){localStorage.setItem(e,hpSetStringValue(t))}function getRelativePos(e){var t=e.getBoundingClientRect();return{x:t.left,y:t.top,height:e.offsetHeight,width:e.offsetWidth,clientWidth:e.clientWidth,clientHeight:e.clientHeight}}function getJsFileBaseUrl(e){e=e||0;for(var t="/[^/]*",n=document.scripts,o=0;o<e;o++)t+=t;return n[n.length-1].src.replace(new RegExp(t+"$"),"")}function hpCreateFileLoaderElement(e,t,n,o){if($headElement){var r;if("js"===e?(r=document.createElement("script")).src=t:((r=document.createElement("link")).setAttribute("rel","stylesheet"),r.href=t),o)for(var i in o)r.setAttribute(i,o[i]);r.onload=r.onerror=n,$headElement.appendChild(r)}}var cache={};function loadMultiple(n,o){for(var r=[],i=0,e=0;e<n.length;e++)!function(t){loadSingle(n[t],function(e){r[t]=e,++i===n.length&&o.apply($undefinedValue,r)})}(e)}function loadSingle(e,t){var n=e.dependencies&&e.dependencies.length,o=e["with"]&&e["with"].length,r=(cache[e.url]||(cache[e.url]={count:0,dependencies:!n,"with":!o,complete:!1,create:!1,url:e.url}),cache[e.url]);function i(){r.complete&&r.dependencies&&r["with"]&&(e.module?t($browserGlobal[e.module]):t())}r.count++,!r.dependencies&&n?(r.dependencies=!0,loadMultiple(e.dependencies,function(){loadSingle(e,t)})):!r["with"]&&o?(r["with"]=!0,loadMultiple(e["with"].concat(e),i)):r.create?variableHasValue(function(){return r.complete},i,300):(r.create=!0,hpCreateFileLoaderElement(e.type,e.url,function(){r.complete=!0,i()},e.attribute))}function libraryFile(e,t){console.log("加载器",e,cache),(e instanceof Array?loadMultiple:loadSingle)(e,t)}function setObjectToString(e){return e=isString(e)?e:JSON.stringify(e)}function setCookie(e,t,n){t=setObjectToString(t);e=e+"="+encodeURI(t)+";path=/;";"number"==typeof n&&((t=new Date).setTime(t.getTime()+n),e+="expires="+t.toUTCString()),document.cookie=e}function getCookie(e,t){t=t||document.cookie;var o="";return t.replace(new RegExp("(^|;\\s)"+e+"=(.*?)($|(;\\s))"),function(e,t,n){o=$decodeURIComponent(n)}),o}function removeCookie(e){setCookie(e,"",-1)}function removeClass(t,e){isArray(e)?forEach(e,function(e){t.classList.remove(e)}):t.classList.remove(e)}function addClass(t,e){isArray(e)?forEach(e,function(e){t.classList.add(e)}):t.classList.add(e)}function toggleClass(e,t,n){removeClass(e,t),addClass(e,n)}export{addClass,downloadFileByArrayBuffer,downloadFileByUrl,getCookie,getJsFileBaseUrl,getRelativePos,getStorage,getWindowSize,libraryFile,observeDomResize,prevent,removeClass,removeCookie,removeElement,removeStorage,setCookie,setStorage,toggleClass};
@@ -6,6 +6,140 @@ declare function getWindowSize(): {
6
6
  height: number;
7
7
  };
8
8
 
9
+ /**
10
+ * 监听DOM尺寸变化
11
+ * @param element - dom元素
12
+ * @param handler - 变换回调函数
13
+ * @param type - 监听类型。默认width+height
14
+ * @param interval - 多久检查一次。默认值:500
15
+ * @returns 销毁方法
16
+ *
17
+ */
18
+ declare function observeDomResize(
19
+ element: HTMLElement,
20
+ handler: (element: HTMLElement) => void,
21
+ type?: ('width' | 'height' | 'position')[],
22
+ interval?: number
23
+ ): () => void;
24
+
25
+ /**
26
+ * 下载 url 文件
27
+ * @param url - 文件地址
28
+ * @param fileName - 文件名
29
+ */
30
+ declare function downloadFileByUrl(url: string, fileName: string): void;
31
+
32
+ /**
33
+ * 下载ArrayBuffer文件
34
+ * @param data - ArrayBuffer格式的数据
35
+ * @param fileName - 文件名
36
+ */
37
+ declare function downloadFileByArrayBuffer(data: ArrayBuffer, fileName: string): void;
38
+
39
+ /**
40
+ * 移除Dom节点
41
+ * @param dom - 待移除的dom元素
42
+ */
43
+ declare function removeElement(el: HTMLElement): void;
44
+
45
+ /**
46
+ * 移除Dom节点
47
+ * @param ev - 事件
48
+ * @param bubble - 阻止冒泡. 默认 true
49
+ * @param stop - 阻止穿透. 默认 true
50
+ */
51
+ declare function prevent(ev: Event, bubble: boolean, stop: boolean): void;
52
+
53
+ /**
54
+ * @param key - 获取的键
55
+ * @returns 保存的值
56
+ */
57
+ declare function getStorage(key: string): string;
58
+
59
+ /**
60
+ * @param key - 删除的键
61
+ * @returns 保存的值
62
+ */
63
+ declare function removeStorage(key: string): void;
64
+
65
+ /**
66
+ * 设置localstorage
67
+ * @param key - 保存的键
68
+ * @param value - 保存的值
69
+ */
70
+ declare function setStorage(key: string, value: any): void;
71
+
72
+ /**
73
+ * 获取dom相对位置
74
+ * @param el - dom
75
+ * @returns 信息
76
+ */
77
+ declare function getRelativePos(el: HTMLElement): {
78
+ x: number;
79
+ y: number;
80
+ height: number;
81
+ width: number;
82
+ clientWidth: number;
83
+ clientHeight: number;
84
+ };
85
+
86
+ /**
87
+ * 获取当前js所在路径
88
+ * @param tir - 向上取几级目录,默认0,当前目录
89
+ * @returns 相对路径
90
+ */
91
+ declare function getJsFileBaseUrl(tir: number): string;
92
+
93
+ interface LibraryFileConfig {
94
+ type: 'js' | 'css';
95
+ url: string;
96
+ module: string;
97
+ dependencies?: LibraryFileConfig[];
98
+ with?: LibraryFileConfig[];
99
+ attribute?: Record<string, string>;
100
+ }
101
+ type SuccessCallback = (...args: any[]) => void;
102
+ /**
103
+ * js和css文件加载器
104
+ * @param files - 文件配置
105
+ * @param callback - 加载成功回调
106
+ */
107
+ declare function libraryFile(
108
+ files: LibraryFileConfig | LibraryFileConfig[],
109
+ callback: SuccessCallback
110
+ ): void;
111
+
112
+ /**
113
+ * 设置cookie。默认path="/"
114
+ * @param key - 设置的键名
115
+ * @param value - 设置的值
116
+ * @param expiredTime - 单位(毫秒)
117
+ */
118
+ declare function setCookie(key: string, value: string, expiredTime?: number): void;
119
+
120
+ /**
121
+ * @param key - 获取的键
122
+ * @param target - 来源,默认document.cookie
123
+ * @returns 保存的值
124
+ */
125
+ declare function getCookie(key: string, target?: string): string;
126
+
127
+ /**
128
+ * 删除cookie
129
+ *
130
+ * @param key - 键名
131
+ */
132
+ declare function removeCookie(key: string): void;
133
+
134
+ /**
135
+ * 给dom元素添加className
136
+ * @param el - DOM
137
+ * @param from - 将要被替换的className
138
+ * @param to - 替换为
139
+ * @returns
140
+ */
141
+ declare function toggleClass(el: HTMLElement, from: string | string[], to: string | string[]): void;
142
+
9
143
  /**
10
144
  * 给dom元素添加className
11
145
  * @param el - DOM
@@ -14,12 +148,39 @@ declare function getWindowSize(): {
14
148
  */
15
149
  declare function addClass(el: HTMLElement, name: string | string[]): void;
16
150
 
151
+ /**
152
+ * 给dom元素移除className
153
+ * @param el - DOM
154
+ * @param name - 需要添加的className
155
+ * @returns
156
+ */
157
+ declare function removeClass(el: HTMLElement, name: string | string[]): void;
158
+
17
159
  declare global {
18
160
  /**
19
161
  * 该声明文件用于全局声明(不用npm安装时拷贝到项目中直接使用)
20
162
  */
21
163
  namespace jUtilsBrowser {
22
- export { addClass, getWindowSize };
164
+ export {
165
+ addClass,
166
+ downloadFileByArrayBuffer,
167
+ downloadFileByUrl,
168
+ getCookie,
169
+ getJsFileBaseUrl,
170
+ getRelativePos,
171
+ getStorage,
172
+ getWindowSize,
173
+ libraryFile,
174
+ observeDomResize,
175
+ prevent,
176
+ removeClass,
177
+ removeCookie,
178
+ removeElement,
179
+ removeStorage,
180
+ setCookie,
181
+ setStorage,
182
+ toggleClass
183
+ };
23
184
  }
24
185
  }
25
186
 
@@ -3,6 +3,6 @@
3
3
  * @QQ 1174295440
4
4
  * @author Bestime
5
5
  * @see https://github.com/bestime/tool
6
- * @update 2023-11-05 11:41:51
6
+ * @update 2023-11-08 22:15:57
7
7
  */
8
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@bestime/utils_base")):"function"==typeof define&&define.amd?define(["exports","@bestime/utils_base"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jUtilsBrowser={},e.jUtilsBase)}(this,function(e,i){"use strict";e.addClass=function(t,e){i.isArray(e)?i.forEach(e,function(e){t.classList.add(e)}):t.classList.add(e)},e.getWindowSize=function(){return{width:document.documentElement.clientWidth||document.body.clientWidth||window.innerWidth||0,height:document.documentElement.clientHeight||document.body.clientHeight||window.innerHeight||0}}});
8
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@bestime/utils_base")):"function"==typeof define&&define.amd?define(["exports","@bestime/utils_base"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jUtilsBrowser={},e.jUtilsBase)}(this,function(e,d){"use strict";var n,i,o=0,r=!1,c={};var s={add:function(e,t){return n="HI-"+ ++o,c[n]={start:+new Date,current:0,handler:e,interval:t},r||(clearInterval(i),r=!0,i=setInterval(function(){for(var e in c){var t=c[e];t.current=+new Date,t.current-t.start>=t.interval&&(t.start=t.current,c[e].handler())}},17)),n},remove:function(e){delete c[e],0===Object.keys(c).length&&(r=!1,clearInterval(i),i=undefined)}};function l(e,t){var n=document.createElement("a");n.style.display="none",n.download=t,n.setAttribute("href",e),n.setAttribute("target","_blank"),n.setAttribute("download",t),document.body.appendChild(n),n.click(),n.remove()}var a=void 0,u=decodeURIComponent,f=window,h=document.getElementsByTagName("head")[0];var m={};function g(n,i){for(var o=[],r=0,e=0;e<n.length;e++)!function(t){p(n[t],function(e){o[t]=e,++r===n.length&&i.apply(a,o)})}(e)}function p(e,t){var n=e.dependencies&&e.dependencies.length,i=e["with"]&&e["with"].length,o=(m[e.url]||(m[e.url]={count:0,dependencies:!n,"with":!i,complete:!1,create:!1,url:e.url}),m[e.url]);function r(){o.complete&&o.dependencies&&o["with"]&&(e.module?t(f[e.module]):t())}if(o.count++,!o.dependencies&&n)o.dependencies=!0,g(e.dependencies,function(){p(e,t)});else if(!o["with"]&&i)o["with"]=!0,g(e["with"].concat(e),r);else if(o.create)d.variableHasValue(function(){return o.complete},r,300);else{o.create=!0;var c,n=e.type,i=e.url,l=function(){o.complete=!0,r()},a=e.attribute;if(h){if("js"===n?(c=document.createElement("script")).src=i:((c=document.createElement("link")).setAttribute("rel","stylesheet"),c.href=i),a)for(var u in a)c.setAttribute(u,a[u]);c.onload=c.onerror=l,h.appendChild(c)}}}function t(e,t,n){i=t,t=i=d.isString(i)?i:JSON.stringify(i);var i=e+"="+encodeURI(t)+";path=/;";"number"==typeof n&&((e=new Date).setTime(e.getTime()+n),i+="expires="+e.toUTCString()),document.cookie=i}function v(t,e){d.isArray(e)?d.forEach(e,function(e){t.classList.remove(e)}):t.classList.remove(e)}function b(t,e){d.isArray(e)?d.forEach(e,function(e){t.classList.add(e)}):t.classList.add(e)}e.addClass=b,e.downloadFileByArrayBuffer=function(e,t){var n=f.URL;l(e=n.createObjectURL(new Blob([e])),t),n.revokeObjectURL(e),undefined},e.downloadFileByUrl=l,e.getCookie=function(e,t){t=t||document.cookie;var i="";return t.replace(new RegExp("(^|;\\s)"+e+"=(.*?)($|(;\\s))"),function(e,t,n){i=u(n)}),i},e.getJsFileBaseUrl=function(e){e=e||0;for(var t="/[^/]*",n=document.scripts,i=0;i<e;i++)t+=t;return n[n.length-1].src.replace(new RegExp(t+"$"),"")},e.getRelativePos=function(e){var t=e.getBoundingClientRect();return{x:t.left,y:t.top,height:e.offsetHeight,width:e.offsetWidth,clientWidth:e.clientWidth,clientHeight:e.clientHeight}},e.getStorage=function(e){return e=localStorage.getItem(e),d.defaultValue(e,"")},e.getWindowSize=function(){return{width:document.documentElement.clientWidth||document.body.clientWidth||window.innerWidth||0,height:document.documentElement.clientHeight||document.body.clientHeight||window.innerHeight||0}},e.libraryFile=function(e,t){console.log("加载器",e,m),(e instanceof Array?g:p)(e,t)},e.observeDomResize=function(n,i,o,e){var r=[0,0,!1],c=[0,0,!1],l=[0,0,!1],a=[0,0,!1],t=s.add(u,e=e||500);function u(){var e,t;document.body.contains(n)?(e=!1,null!=o&&o.includes("position")&&(t=n.getBoundingClientRect(),l[0]=t.left,l[2]=l[0]!==l[1],a[0]=t.top,a[2]=a[0]!==a[1]),r[0]=n.offsetWidth,r[2]=r[0]!==r[1],c[0]=n.offsetHeight,c[2]=c[0]!==c[1],r[2]&&(r[1]=r[0],null!=o&&o.includes("width")&&(e=!0)),c[2]&&(c[1]=c[0],null!=o&&o.includes("height")&&(e=!0)),(a[2]||l[2])&&(a[1]=a[0],l[1]=l[0],null!=o&&o.includes("position")&&(e=!0)),o&&0!==o.length||(r[2]||c[2]||a[2]||l[2])&&(e=!0),e&&i(n)):d()}function d(){s.remove(t),r=undefined,c=undefined}return u(),d},e.prevent=function(e,t,n){e=e||f.event,n=!1!==n,(t=!1!==t)&&f.event?f.event.cancelBubble=!0:e.stopPropagation(),n&&f.event?f.event.returnValue=!1:e.preventDefault()},e.removeClass=v,e.removeCookie=function(e){t(e,"",-1)},e.removeElement=function(e){e.parentNode&&e.parentNode.removeChild(e)},e.removeStorage=function(e){localStorage.removeItem(e)},e.setCookie=t,e.setStorage=function(e,t){localStorage.setItem(e,(e=t,e=d.isString(e)?e:JSON.stringify(e)))},e.toggleClass=function(e,t,n){v(e,t),b(e,n)}});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bestime/utils_browser",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "main": "./dist/jUtilsBrowser.esm.min.mjs",
5
5
  "module": "./dist/jUtilsBrowser.esm.min.mjs",
6
6
  "types": "./dist/jUtilsBrowser.esm.d.ts",
@@ -13,6 +13,10 @@
13
13
  "build": "rollup --config rollup.config.prod.js",
14
14
  "serve": "rollup --config rollup.config.dev.js --watch"
15
15
  },
16
+
17
+ "dependencies": {
18
+ "@bestime/utils_base": "^1.0.3"
19
+ },
16
20
  "devDependencies": {
17
21
  "@babel/core": "7.18.6",
18
22
  "@babel/plugin-proposal-class-properties": "^7.18.6",
@@ -48,8 +52,5 @@
48
52
  "homepage": "https://github.com/bestime/tool",
49
53
  "publishConfig": {
50
54
  "access": "public"
51
- },
52
- "dependencies": {
53
- "@bestime/utils_base": "^1.0.1"
54
55
  }
55
56
  }