Plugins system using typescript and/or ts classes

This commit is contained in:
Core 2022-01-16 16:14:40 +00:00
parent b0118dff5b
commit 89e867ffab
No known key found for this signature in database
GPG key ID: 1B77805746C47C28
3 changed files with 69 additions and 23 deletions

View file

@ -1,33 +1,51 @@
let i = 1, k = 1;
export default class ExamplePlugin {
/**
* Base Plugin Details (Eventually implemented into a GUI in settings)
*/
public name: string = 'examplePlugin';
public description: string = 'Example plugin';
public version: string = '1.0.0';
public author: string = 'Example author';
/**
* Runs on plugin load (Currently run on application start)
*/
constructor() {
this.name = 'coolPlugin';
this.description = 'A pretty cool plugin';
this.version = '1.0.0';
this.author = 'Core';
}
onStart(): void {
console.log('Example plugin started');
}
/**
* Runs on app ready
*/
onReady(): void {
console.log('Example plugin ready');
}
/**
* Runs on app stop
*/
onStop(): void {
console.log('Example plugin stopped');
}
OnPlaybackStateChanged(attributes: object): void {
/**
* Runs on playback State Change
* @param attributes Music Attributes (attributes.state = current state)
*/
onPlaybackStateDidChange(attributes: object): void {
console.log('onPlaybackStateDidChange has been called ' + i +' times');
i++
}
OnMediaStateChanged(attributes: object): void {
/**
* Runs on song change
* @param attributes Music Attributes
*/
onNowPlayingItemDidChange(attributes: object): void {
console.log('onNowPlayingDidChange has been called ' + k +' times');
k++
}
}