Gathering detailed insights and metrics for vuex-iframe-share
Gathering detailed insights and metrics for vuex-iframe-share
Gathering detailed insights and metrics for vuex-iframe-share
Gathering detailed insights and metrics for vuex-iframe-share
This is a package for data synchronization of vuex data in iframe in the vuejs project
npm install vuex-iframe-share
Typescript
Module System
Node Version
NPM Version
TypeScript (98.83%)
JavaScript (1.17%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
8 Stars
13 Commits
1 Forks
1 Watchers
11 Branches
1 Contributors
Updated on Mar 21, 2023
Latest Version
1.0.10
Package Id
vuex-iframe-share@1.0.10
Unpacked Size
135.28 kB
Size
31.25 kB
File Count
8
NPM Version
8.5.0
Node Version
16.14.2
Published on
Mar 21, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
5
English | 中文
Engineers who use vuejs should know what vuex is! It is an essential tool in actual development. But when we use vuejs + iframe to develop applications, we will find that data communication is a headache. You need to use postMessage
every time. To solve this problem, vuex-iframe-share
is born. Let the vuex in the current day's Vue and the vuex in iframe share data. If your iframe doesn't use vuejs, it doesn't matter, vuex-iframe-share
will store the data in the window.(local|session)Storage
In.
store.state
updateValue === originalValue situation, The set
function will no longer be triggered to prevent abuse of the watch
(v1.0.10)window.parant
check to prevent use in non iframes, which may lead to deadlock (v1.0.10)state.set('module/data', ...)
: Uncaught TypeError: Cannot read property 'module' of null(v1.0.7)vuex-persistedstate
, new option mutationMethodName
(v1.0.6)vuexIframeShare.storage
error reporting for null(v1.0.5)window.postMessage
, it has some limitations to note. For example, the transmission size and so on. There are references below1<script src="https://cdn.jsdelivr.net/npm/vuex-iframe-share/dist/vuex-iframe-share.umd.min.js"></script>
1npm install --save vuex-iframe-share
1yarn add vuex-iframe-share
1vuexIframeShare.parant(option) 2vuexIframeShare.child(option) 3vuexIframeShare.storage(option)
1option: { 2 // share # mutual transmission (default) 3 // single # receive only and not send 4 mode?: 'single' | 'share' 5 only?: string[] // receive only the specified keys,It also includes the modules name, because the modules name is also stored in the state 6 7 // This parameter is only available in vuexIframeShare.storage Valid in. 8 // In vuejs, please use such as: `vuex-persistedstate ...` package 9 storage?: Storage // sessionStorage | localStorage (default) 10 11 mutationMethodName?: string // It will only take effect if it is used in conjunction with 'vuex-persistedstate' 12}
1import vuexIframeShare from "vuex-iframe-share"; 2 3const store = new Vuex.Store({ 4 state: { 5 ... 6 }, 7 plugins: [vuexIframeShare.parant()] 8});
1import vuexIframeShare from "vuex-iframe-share"; 2 3const store = new Vuex.Store({ 4 state: { 5 ... 6 }, 7 plugins: [vuexIframeShare.child()] 8});
1import vuexIframeShare from "vuex-iframe-share"; 2 3// Mount 4const state = vuexIframeShare.storage(); 5 6// Getter or Modules Getter 7const vuexData = state.get() 8const data = state.get('data') 9const moduleData = state.get('moduleName/data') 10 11// Setter or Modules Setter 12state.set('data', here is to save the data) 13state.set('moduleName/data', here is to save the data) 14 15// It is worth mentioning that after setter, there are the latest vuex results, so we can do this: 16const vuexData = state.set('data', here is to save the data) 17 18// You can also use structure assignment 19const { ... } = state.set('data', here is to save the data)
What is vuex-persistedstate
?
(local|session)Storage
or other storage methods so that it can be used again after refreshingThe data synchronized by vuex-iframe-share
is only synchronized to memory, and no update is stored in storage,This is not bug,This is related to the update mechanism of vuex-persistedstate
. We can do this to solve this problem
1// in `store.js` 2import vuexIframeShare from "vuex-iframe-share"; 3 4const store = new Vuex.Store({ 5 mutations: { 6 // Add refresh method here, recommended use Object.assign 7 save(state, payload) { 8 Object.assign(state, payload) 9 } 10 ... 11 }, 12 plugins: [ 13 //In principle, let 'vuex iframe share' execute once store.commit ('save ', {}), execution will trigger the update! 14 //Note: there is a value when executing 'Save': '{}' if you write like me above, you don't need to do any processing, otherwise you need to filter '{}' 15 //Or write it in the module: 'modulename / save', of course, it doesn't make any difference, just to trigger the refresh 16 vuexIframeShare.parant({ mutationMethodName: 'save' }) 17 ] 18}); 19
If you find any problem, you can give me the issue feedback in GitHub. I will reply after receiving it. Thank you for using this plug-in
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/13 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
45 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More