File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed
resources/js/electron-plugin Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -2,16 +2,16 @@ import Store from "electron-store";
2
2
import { notifyLaravel } from "./utils.js" ;
3
3
const settingsStore = new Store ( ) ;
4
4
settingsStore . onDidAnyChange ( ( newValue , oldValue ) => {
5
- const changedKey = Object . keys ( newValue ) . find ( ( key ) => newValue [ key ] !== oldValue [ key ] ) ;
6
- if ( changedKey ) {
5
+ const changedKeys = Object . keys ( newValue ) . filter ( ( key ) => newValue [ key ] !== oldValue [ key ] ) ;
6
+ changedKeys . forEach ( ( key ) => {
7
7
notifyLaravel ( "events" , {
8
8
event : "Native\\Laravel\\Events\\Settings\\SettingChanged" ,
9
9
payload : {
10
- key : changedKey ,
11
- value : newValue [ changedKey ] || null ,
10
+ key,
11
+ value : newValue [ key ] || null ,
12
12
} ,
13
13
} ) ;
14
- }
14
+ } ) ;
15
15
} ) ;
16
16
function generateRandomString ( length ) {
17
17
let result = "" ;
Original file line number Diff line number Diff line change @@ -5,19 +5,17 @@ import { notifyLaravel } from "./utils.js";
5
5
const settingsStore = new Store ( ) ;
6
6
settingsStore . onDidAnyChange ( ( newValue , oldValue ) => {
7
7
// Only notify of the changed key/value pair
8
- const changedKey = Object . keys ( newValue ) . find (
9
- ( key ) => newValue [ key ] !== oldValue [ key ]
10
- ) ;
8
+ const changedKeys = Object . keys ( newValue ) . filter ( ( key ) => newValue [ key ] !== oldValue [ key ] ) ;
11
9
12
- if ( changedKey ) {
10
+ changedKeys . forEach ( ( key ) => {
13
11
notifyLaravel ( "events" , {
14
12
event : "Native\\Laravel\\Events\\Settings\\SettingChanged" ,
15
13
payload : {
16
- key : changedKey ,
17
- value : newValue [ changedKey ] || null ,
14
+ key,
15
+ value : newValue [ key ] || null ,
18
16
} ,
19
17
} ) ;
20
- }
18
+ } ) ;
21
19
} ) ;
22
20
23
21
interface State {
You can’t perform that action at this time.
0 commit comments