MCPcopy Index your code
hub / github.com/easydiffusion/easydiffusion / setSetting

Function setSetting

ui/media/js/auto-save.js:131–150  ·  view source on GitHub ↗
(element, value)

Source from the content-addressed store, hash-verified

129 return element.value
130}
131function setSetting(element, value) {
132 if (element.dataset && "path" in element.dataset) {
133 element.dataset.path = value
134 return // no need to dispatch any event here because the models are not loaded yet
135 }
136 if (typeof element === "string" || element instanceof String) {
137 element = SETTINGS[element].element
138 }
139 SETTINGS[element.id].value = value
140 if (getSetting(element) == value) {
141 return // no setting necessary
142 }
143 if (element.type == "checkbox") {
144 element.checked = value
145 } else {
146 element.value = value
147 }
148 element.dispatchEvent(new Event("input"))
149 element.dispatchEvent(new Event("change"))
150}
151
152function saveSettings() {
153 var saved_settings = Object.values(SETTINGS).map((setting) => {

Callers 4

loadSettingsFunction · 0.85
tryLoadOldSettingsFunction · 0.85
setDiskPathFunction · 0.85

Calls 2

getSettingFunction · 0.85
dispatchEventMethod · 0.45

Tested by

no test coverage detected