@rive-app/webgl-single 2.3.1 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rive-app/webgl-single",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "description": "Rive's webgl based web api with bundled wasm.",
5
5
  "main": "rive.js",
6
6
  "homepage": "https://rive.app",
package/rive.d.ts CHANGED
@@ -95,6 +95,10 @@ export declare class StateMachineInput {
95
95
  */
96
96
  fire(): void;
97
97
  }
98
+ export declare enum RiveEventType {
99
+ General = 128,
100
+ OpenUrl = 131
101
+ }
98
102
  /**
99
103
  * Supported event types triggered in Rive
100
104
  */
@@ -107,11 +111,13 @@ export declare enum EventType {
107
111
  Loop = "loop",
108
112
  Draw = "draw",
109
113
  Advance = "advance",
110
- StateChange = "statechange"
114
+ StateChange = "statechange",
115
+ RiveEvent = "riveevent"
111
116
  }
117
+ export type RiveEventPayload = rc.RiveEvent | rc.OpenUrlEvent;
112
118
  export interface Event {
113
119
  type: EventType;
114
- data?: string | string[] | LoopEvent | number;
120
+ data?: string | string[] | LoopEvent | number | RiveEventPayload;
115
121
  }
116
122
  /**
117
123
  * Looping types: one-shot, loop, and ping-pong
@@ -189,6 +195,18 @@ export interface RiveParameters {
189
195
  * will be attached to the <canvas> element
190
196
  */
191
197
  shouldDisableRiveListeners?: boolean;
198
+ /**
199
+ * Enable Rive Events to be handled by the runtime. This means any special Rive Event may have
200
+ * a side effect that takes place implicitly.
201
+ *
202
+ * For example, if during the render loop an OpenUrlEvent is detected, the
203
+ * browser may try to open the specified URL in the payload.
204
+ *
205
+ * This flag is false by default to prevent any unwanted behaviors from taking place.
206
+ * This means any special Rive Event will have to be handled manually by subscribing to
207
+ * EventType.RiveEvent
208
+ */
209
+ automaticallyHandleEvents?: boolean;
192
210
  onLoad?: EventCallback;
193
211
  onLoadError?: EventCallback;
194
212
  onPlay?: EventCallback;
@@ -266,6 +284,7 @@ export declare class Rive {
266
284
  private animator;
267
285
  private static readonly missingErrorMessage;
268
286
  private shouldDisableRiveListeners;
287
+ private automaticallyHandleEvents;
269
288
  durations: number[];
270
289
  frameTimes: number[];
271
290
  frameCount: number;