Loading files
5369e47efThis file is pinned to the selected release. Download the original to open it in your design tool.
Files from this revision, including CAD and LFS contents. Git history is not included.
Or in GitHub Desktop, choose File → Clone repository → URL and paste this address.
Public repositories can be cloned without signing in. For pushing, use your ThingAtlas username and a Git access token as the password.
git lfs install git clone https://thingatlas.com/git/-unclaimed/stack-chan-374381865.git
Includes Git history, branches, and Git LFS files. Clones the repository’s default branch, regardless of the version shown here.
import structuredClone from 'structuredClone'
import { type DOMAIN, PREF_KEYS } from 'consts'
import config from 'mc/config'
import Modules from 'modules'
import Preference from 'preference'
// biome-ignore lint/suspicious/noExplicitAny: Match the type definition of mc/config
type ConfigRecord = Record<string, any>
const modConfig: ConfigRecord = Modules.has('mod/config') ? (Modules.importNow('mod/config') as ConfigRecord) : {}
export default function loadPreferences(category: keyof typeof DOMAIN) {
const mcPreference = structuredClone(config[category.toLowerCase()] ?? {})
const modPreference = structuredClone(modConfig[category.toLowerCase()] ?? {})
const preference = { ...mcPreference, ...modPreference }
const keys = PREF_KEYS.filter((s) => s[0] === category)
for (const [domain, key, ctor] of keys) {
const value = Preference.get(domain, key)
if (value != null) {
preference[key] = ctor(value)
}
}
return preference
}
5369e47efThis file is pinned to the selected release. Download the original to open it in your design tool.