34-midi #35

Merged
thinkode merged 12 commits from 34-midi into develop 2025-12-02 18:02:18 +00:00
3 changed files with 10 additions and 44 deletions
Showing only changes of commit 2dc6f4a38a - Show all commits

View File

@@ -1,38 +0,0 @@
{
"compilerOptions": {
"moduleResolution": "Node",
"target": "ESNext",
"module": "ESNext",
/**
* svelte-preprocess cannot figure out whether you have
* a value or a type, so tell TypeScript to enforce using
* `import type` instead of `import` for Types.
*/
"importsNotUsedAsValues": "error",
"isolatedModules": true,
"resolveJsonModule": true,
/**
* To have warnings / errors of the Svelte compiler at the
* correct position, enable source maps by default.
*/
"sourceMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"baseUrl": ".",
/**
* Typecheck JS in `.svelte` and `.js` files by default.
* Disable this if you'd like to use dynamic types.
*/
"checkJs": true
},
/**
* Use global.d.ts instead of compilerOptions.types
* to avoid limiting type declarations.
*/
"include": [
"src/**/*.d.ts",
"src/**/*.js",
"src/**/*.svelte"
]
}

View File

@@ -165,10 +165,10 @@ export function initRuntimeEvents(){
EventsOn('LOAD_PROJECT', loadProject)
// Handle a peripheral loaded in the project
EventsOn('LOAD_PERIPHERAL', loadPeripheral)
EventsOn('PERIPHERAL_LOAD', loadPeripheral)
// Handle a peripheral unloaded from the project
EventsOn('UNLOAD_PERIPHERAL', unloadPeripheral)
EventsOn('PERIPHERAL_UNLOAD', unloadPeripheral)
// Handle a peripheral event
EventsOn('PERIPHERAL_EVENT_EMITTED', onPeripheralEvent)
@@ -191,10 +191,10 @@ export function destroyRuntimeEvents(){
EventsOff('LOAD_PROJECT')
// Handle a peripheral loaded in the project
EventsOff('LOAD_PERIPHERAL')
EventsOff('PERIPHERAL_LOAD')
// Handle a peripheral unloaded from the project
EventsOff('UNLOAD_PERIPHERAL')
EventsOff('PERIPHERAL_UNLOAD')
// Handle a peripheral event
EventsOff('PERIPHERAL_EVENT_EMITTED')

View File

@@ -22,6 +22,10 @@ const (
PeripheralArrival PeripheralEvent = "PERIPHERAL_ARRIVAL"
// PeripheralRemoval is triggered when a peripheral has been disconnected from the system
PeripheralRemoval PeripheralEvent = "PERIPHERAL_REMOVAL"
// PeripheralLoad is triggered when a peripheral is added to the project
PeripheralLoad PeripheralEvent = "PERIPHERAL_LOAD"
// PeripheralUnload is triggered when a peripheral is removed from the project
PeripheralUnload PeripheralEvent = "PERIPHERAL_UNLOAD"
// PeripheralStatusUpdated is triggered when a peripheral status has been updated (disconnected - connecting - deactivated - activated)
PeripheralStatusUpdated PeripheralEvent = "PERIPHERAL_STATUS"
// PeripheralEventEmitted is triggered when a peripheral event is emitted
@@ -85,7 +89,7 @@ func (h *Manager) RegisterPeripheral(ctx context.Context, peripheralData Periphe
}
// Emits the event in the hardware
runtime.EventsEmit(ctx, "LOAD_PERIPHERAL", peripheralData)
runtime.EventsEmit(ctx, string(PeripheralLoad), peripheralData)
return peripheralData.SerialNumber, nil
}
@@ -110,7 +114,7 @@ func (h *Manager) UnregisterPeripheral(ctx context.Context, peripheralData Perip
}
}
delete(h.savedPeripherals, peripheralData.SerialNumber)
runtime.EventsEmit(ctx, "UNLOAD_PERIPHERAL", peripheralData)
runtime.EventsEmit(ctx, string(PeripheralUnload), peripheralData)
return nil
}