prepare for flow typing, add start of plugin sys
parent
64e5a9f113
commit
db20d53d5a
@ -0,0 +1,10 @@
|
||||
import esbuild from 'esbuild'
|
||||
import flow from 'esbuild-plugin-flow'
|
||||
|
||||
esbuild.build({
|
||||
entryPoints: ['src/index.js'],
|
||||
outfile: 'dist/build.js',
|
||||
bundle: true,
|
||||
minify: true,
|
||||
plugins: [flow(/\.flow\.jsx\.js?$/)]
|
||||
})
|
@ -0,0 +1,20 @@
|
||||
import { get, set } from 'idb-keyval';
|
||||
|
||||
async function addPlugin(onStart, onStop, getMeta, metadata=null) {
|
||||
if (metadata === null) metadata = getMeta(); // expected output: {name: "name", desc: "description", author: "author"}
|
||||
const obj = { // whether the plugin is started or stopped isn't going to be stored in the iDB, so it can be accessed more easily by all components
|
||||
metadata: metadata,
|
||||
code: {
|
||||
start: onStart,
|
||||
stop: onStop
|
||||
},
|
||||
enabled: false // should plugins be enabled by default? not sure
|
||||
}
|
||||
const globalSettings = await get("demoncord");
|
||||
if (globalSettings[metadata.name] !== undefined) {
|
||||
console.log("[Demoncord] Cannot add plugin that already exists!")
|
||||
return false
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in new issue