65 lines
1.4 KiB
Dart
65 lines
1.4 KiB
Dart
class RuntimeEvent {
|
|
const RuntimeEvent({
|
|
required this.type,
|
|
this.target,
|
|
this.handler,
|
|
this.x,
|
|
this.y,
|
|
this.data = const {},
|
|
this.sessionId,
|
|
this.scope,
|
|
this.targetEpoch,
|
|
this.scopeEpoch,
|
|
});
|
|
|
|
final String type;
|
|
final String? target;
|
|
final String? handler;
|
|
final double? x;
|
|
final double? y;
|
|
final Map<String, Object?> data;
|
|
|
|
/// Runtime-internal lifecycle session. Not exposed to Lua.
|
|
final int? sessionId;
|
|
|
|
/// Runtime-internal lifecycle scope. Not exposed to Lua.
|
|
final String? scope;
|
|
|
|
/// Runtime-internal target node epoch. Not exposed to Lua.
|
|
final int? targetEpoch;
|
|
|
|
/// Runtime-internal scope node epoch. Not exposed to Lua.
|
|
final int? scopeEpoch;
|
|
|
|
RuntimeEvent withLifecycle({
|
|
int? sessionId,
|
|
String? scope,
|
|
int? targetEpoch,
|
|
int? scopeEpoch,
|
|
}) {
|
|
return RuntimeEvent(
|
|
type: type,
|
|
target: target,
|
|
handler: handler,
|
|
x: x,
|
|
y: y,
|
|
data: data,
|
|
sessionId: sessionId ?? this.sessionId,
|
|
scope: scope ?? this.scope,
|
|
targetEpoch: targetEpoch ?? this.targetEpoch,
|
|
scopeEpoch: scopeEpoch ?? this.scopeEpoch,
|
|
);
|
|
}
|
|
|
|
Map<String, Object?> toMap() {
|
|
return {
|
|
'type': type,
|
|
if (target != null) 'target': target,
|
|
if (handler != null) 'handler': handler,
|
|
if (x != null) 'x': x,
|
|
if (y != null) 'y': y,
|
|
if (data.isNotEmpty) 'data': data,
|
|
};
|
|
}
|
|
}
|