Skip to content

refactor: use enums for aligment use union for properties#3

Merged
mfazekas merged 2 commits intomainfrom
mfazekas/fix-alignment-properties
Oct 30, 2025
Merged

refactor: use enums for aligment use union for properties#3
mfazekas merged 2 commits intomainfrom
mfazekas/fix-alignment-properties

Conversation

@mfazekas
Copy link
Copy Markdown
Collaborator

@mfazekas mfazekas commented Oct 29, 2025

  • Use string based enums for alignment
  • Use correct properties?: Record<string, EventPropertiesOutput>; instead of AnyMap
  • Declare RiveEvent on TS side so that only type = RiveEventType.OpenUrl has url and target fields.

Marc suggested to use different listeners for each type. So there would be an onURLEvent on onGeneralEvent, but it's a bit of a pain as we need to maintain listeners for that and remove functions, etc for every event type. But we could convert back to a single function on TS side. We can covert to that solution later.

@mfazekas mfazekas marked this pull request as ready for review October 29, 2025 15:20
target?: string;
}

export type RiveEvent = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really nice. I always forget TypeScript can do this.

@@ -0,0 +1,15 @@
import Foundation

extension EventPropertiesOutput {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Copy link
Copy Markdown
Contributor

@HayesGordon HayesGordon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@mfazekas mfazekas merged commit ef05403 into main Oct 30, 2025
5 checks passed
mfazekas added a commit that referenced this pull request Nov 17, 2025
* refactor: use enums for aligment use union for properties

* fix(api): use RiveEvent union for TS side and UnifiedRiveEvent struct for native side
@HayesGordon HayesGordon deleted the mfazekas/fix-alignment-properties branch December 9, 2025 16:25
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.

2 participants