I've started learning miniSphere more recently, but modules are surprisingly simple:
- Create a new mjs file, put some code in there.
- Prepend the export keyword to whatever functions or classes or variables you want to use in other script files.
- Do an import in those other script files.
Example:
main.mjs
import { SomeFunction, SomeClass } from '$/myscript'; //Refers to those functions in myscript.mjs
SomeFunction();
var f = new SomeClass();
myscript.mjs
export function SomeFunction() {
//Regular function code in here
}
export class SomeClass() {
constructor() {
//Do class stuff in here or whatever
}
}
Maybe you could come chat in the Discord chat, it's been very useful to me to get the hang of how things work as Fat Cerberus and Rhuan hang out there all the time.