store latest params in the store

This commit is contained in:
Kurt Hutten
2021-08-07 17:00:29 +10:00
parent 2d7df96ad9
commit 02160e1e8e
6 changed files with 43 additions and 35 deletions

View File

@@ -28,7 +28,7 @@ export function genParams(
defs,
target,
storedParams = {},
callback = undefined,
callback: (values: RawCustomizerParams, source: any) => void = undefined,
buttons = ['reset', 'save', 'load', 'edit', 'link']
) {
const funcs = {
@@ -140,7 +140,7 @@ export function genParams(
if (missingKeys.length) console.log('missing param impl', missingKeys)
function _callback(source = 'change') {
if (callback) callback(getParams(target), source)
if (callback && source !== 'group') callback(getParams(target), source)
}
html += '<div class="jscad-param-buttons"><div>'
@@ -179,7 +179,7 @@ export function genParams(
})
}
export function getParams(target: HTMLElement): RawCustomizerParams {
function getParams(target: HTMLElement): RawCustomizerParams {
const params = {}
if (!target) return params