Skip to content

Conversation

@SnaveSutit
Copy link
Contributor

@SnaveSutit SnaveSutit commented Jan 7, 2026

  • Events are now defined using the BlockbenchEventMap interface.
  • Event data is now fully type-safe.

Event functions previously only allowed built-in events, but now users can define their own events with full type safety:

declare global {
    interface BlockbenchEventMap {
        my_event: {foo: boolean, bar: Cube}
    }
}
Blockbench.dispatchEvent('my_event', {foo: false, bar: new Cube()})

NOTE: Most built-in events have any as their datatype, as I'm not 100% sure what each event expects / allows.

Provides auto-complete for built-in events, while also allowing users to define their own without red squigglies everywhere.
Adds type checking to event data in callbacks and `dispatchEvent` calls.

Only plugin load events have typed data at the moment. But all events are included in the Event map, so typing can be added over time.
- Renamed `EventName` -> `BlockbenchEventName`
- Renamed `EventMap` -> `BlockbenchEventMap`
(Renamed for clarity)

Since events can now be added by users using `interface` merging, I've removed the generic `string` type from event names.
@netlify
Copy link

netlify bot commented Jan 7, 2026

Deploy Preview for blockbench-dev ready!

Name Link
🔨 Latest commit e7d3d2a
🔍 Latest deploy log https://app.netlify.com/projects/blockbench-dev/deploys/695eb5e5149593000893ae67
😎 Deploy Preview https://deploy-preview-3250--blockbench-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant