Move stuff around to remove need for code hoisting

This commit is contained in:
Andrew Kingston 2024-05-24 10:34:58 +01:00
parent 62eb1f413e
commit 37b1bc45cf
1 changed files with 5 additions and 8 deletions

View File

@ -12,10 +12,8 @@
const flipDurationMs = 130 const flipDurationMs = 130
const { OptionColours } = Constants const { OptionColours } = Constants
const getDefaultColor = idx => OptionColours[idx % OptionColours.length]
let openOption = null const options = writable(
let anchor = null
let options = writable(
constraints.inclusion.map((value, idx) => ({ constraints.inclusion.map((value, idx) => ({
id: Math.random(), id: Math.random(),
name: value, name: value,
@ -24,6 +22,9 @@
})) }))
) )
let openOption = null
let anchor = null
$: options.subscribe(updateConstraints) $: options.subscribe(updateConstraints)
const updateConstraints = options => { const updateConstraints = options => {
@ -34,10 +35,6 @@
) )
} }
const getDefaultColor = idx => {
return OptionColours[idx % OptionColours.length]
}
const addNewInput = async () => { const addNewInput = async () => {
const newId = Math.random() const newId = Math.random()
const newName = getSequentialName($options, "Option ", { const newName = getSequentialName($options, "Option ", {