mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-05 19:24:39 +00:00
Update creating-plugins.md
This commit is contained in:
@@ -65,13 +65,13 @@ const myPlugin: Plugin<MyPluginSettings, MyPluginStorage> = {
|
|||||||
// Initialize your settings here
|
// Initialize your settings here
|
||||||
},
|
},
|
||||||
run: (api) => {
|
run: (api) => {
|
||||||
if (!api.settings.get('enabled')) {
|
if (!api.settings.enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize storage with default values if needed
|
// Initialize storage with default values if needed
|
||||||
if (api.storage.get('lastRun') === undefined) {
|
if (api.storage.lastRun === undefined) {
|
||||||
api.storage.set('lastRun', new Date().toISOString());
|
api.storage.lastRun = new Date().toISOString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Your plugin logic goes here
|
// Your plugin logic goes here
|
||||||
@@ -147,7 +147,7 @@ api.seqta.onPageLoad('/timetable', () => {
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// Get a setting value
|
// Get a setting value
|
||||||
const isEnabled = api.settings.get('enabled');
|
const isEnabled = api.settings.enabled;
|
||||||
|
|
||||||
// Listen for settings changes
|
// Listen for settings changes
|
||||||
api.settings.onChange('enabled', (newValue) => {
|
api.settings.onChange('enabled', (newValue) => {
|
||||||
@@ -163,10 +163,10 @@ api.settings.onChange('enabled', (newValue) => {
|
|||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
// Get a stored value
|
// Get a stored value
|
||||||
const lastRun = api.storage.get('lastRun');
|
const lastRun = api.storage.lastRun;
|
||||||
|
|
||||||
// Set a stored value
|
// Set a stored value
|
||||||
api.storage.set('lastRun', new Date().toISOString());
|
api.storage.lastRun = new Date().toISOString();
|
||||||
|
|
||||||
// Listen for storage changes
|
// Listen for storage changes
|
||||||
api.storage.onChange('lastRun', (newValue) => {
|
api.storage.onChange('lastRun', (newValue) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user