// 2. apply to context in order (order matters!) this.activePlugins.set(plugin.id, plugin); this.reorder(); // sort by category/priority
function encodePreset(preset) return btoa(JSON.stringify(preset)); plugin selection toys
reorder() // sort: visual → physics → audio (example) this.activePlugins = new Map([...this.activePlugins.entries()] .sort((a,b) => orderMap[a[1].category] - orderMap[b[1].category])); orderMap[a[1].category] - orderMap[b[1].category]))
getPipeline() return Array.from(this.activePlugins.values()); getPipeline() return Array.from(this.activePlugins.values())