This repository was archived by the owner on Apr 10, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
This repository was archived by the owner on Apr 10, 2022. It is now read-only.
Proposal: Extension Structure #1
Copy link
Copy link
Open
Description
I propose the following structure for XKit 8 extension:
ES6 Module
BaseExtension.js
class XKitExtension {
constructor(XKit) {
this.api = XKit;
}
get __meta() {
return {
Name: 'Unnamed',
Version: 'X.Y.Z',
ShortDescription: 'Base Extension',
Description: 'The base class for XKit Extensions',
Authors: ['new-xkit'],
};
}
get __preferences() {
return [
{
Name: 'Preference 1',
default: true,
},
];
}
async install() {
// The extension has been installed for the first time
}
async reinstall() {
// The extension has been installed before but has now been reinstalled
}
async update(previousVersion, currentVersion) {
// The extension has been updated to the latest version
}
async start() {
// The extension is being loaded by the framework as part of boostrap
}
async stop() {
// The extension is being unloaded
}
get api() {
return {}; // Functions that are going to be called by other Extensions are set here -> Sandboxing
}
}XKit Extension:
class DemoExtension extends XKitExtension {
update(prevVersion, currentVersion) {
console.log(`You have succesfully updated DemoExtension from ${prevVersion} to ${currentVersion}`);
}
enable() {
this.api.doStuffToTumblr();
}
}Questions to answer:
- Are all the functions necessary? For example is there a point to having an extension know it has been installed before?
- Are there any functions missing?
- What are the function signatures?
- What else should be put into the
__metablock - How do we handle defining preferences?
Metadata
Metadata
Assignees
Labels
No labels