MCPcopy Create free account
hub / github.com/Tencent/kbone / $_triggerStorage

Method $_triggerStorage

packages/miniprogram-render/src/bom/storage.js:13–35  ·  view source on GitHub ↗

* 触发 window 的 storage 事件

(key, newValue, oldValue, force)

Source from the content-addressed store, hash-verified

11 * 触发 window 的 storage 事件
12 */
13 $_triggerStorage(key, newValue, oldValue, force) {
14 if (!force && newValue === oldValue) return
15
16 const currentWindow = cache.getWindow(this.$_pageId)
17 const windowList = cache.getWindowList() || []
18 windowList.forEach(window => {
19 if (window && window !== currentWindow) {
20 window.$$trigger('storage', {
21 event: new Event({
22 name: 'storage',
23 target: window,
24 $$extra: {
25 key,
26 newValue,
27 oldValue,
28 storageArea: this,
29 url: currentWindow.location.href,
30 }
31 })
32 })
33 }
34 })
35 }
36
37 /**
38 * 对外属性和方法

Callers 6

setItemMethod · 0.80
removeItemMethod · 0.80
clearMethod · 0.80
setItemMethod · 0.80
removeItemMethod · 0.80
clearMethod · 0.80

Calls 1

$$triggerMethod · 0.45

Tested by

no test coverage detected