mirror of
https://github.com/thelounge/thelounge
synced 2024-11-22 20:13:07 +00:00
25da9dd63e
Behavior includes: default value, whether setting should be synced, and an optional 'apply' callback which is called when setting is changed in Vuex.
20 lines
522 B
JavaScript
20 lines
522 B
JavaScript
"use strict";
|
|
|
|
const socket = require("../socket");
|
|
const store = require("../store").default;
|
|
|
|
socket.on("setting:new", function(data) {
|
|
const name = data.name;
|
|
const value = data.value;
|
|
store.dispatch("settings/update", {name, value, sync: false});
|
|
});
|
|
|
|
socket.on("setting:all", function(settings) {
|
|
if (Object.keys(settings).length === 0) {
|
|
store.dispatch("settings/syncAll");
|
|
} else {
|
|
for (const name in settings) {
|
|
store.dispatch("settings/update", {name, value: settings[name], sync: false});
|
|
}
|
|
}
|
|
});
|