Skip to content

Commit a01f81c

Browse files
committed
convert before submit event to extension type
1 parent aba656d commit a01f81c

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

lib/src/web/static_interop/screenset_event/before_submit_event.dart

+5-15
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,23 @@
1-
import 'package:js/js.dart';
2-
import 'package:js/js_util.dart';
1+
import 'dart:js_interop';
32

43
import '../../../models/screenset_event.dart';
54
import '../models/profile.dart';
65

7-
/// This typedef defines the function signature for the handler of the screenset before submit event.
8-
///
9-
/// This function should return false if submission should be cancelled.
10-
typedef BeforeSubmitEventHandler = bool Function(ScreensetEvent event);
11-
12-
/// The static interop class for the before submit event of the `Account.showScreenset` event stream.
6+
/// The extension type for the before submit event of the `Account.showScreenset` event stream.
137
///
148
/// See: https://help.sap.com/docs/SAP_CUSTOMER_DATA_CLOUD/8b8d6fffe113457094a17701f63e3d6a/413a5b7170b21014bbc5a10ce4041860.html?locale=en-US#onbeforesubmit-event-data
159
@JS()
1610
@anonymous
1711
@staticInterop
18-
class BeforeSubmitEvent {}
19-
20-
/// This extension defines the static interop definition
21-
/// for the [BeforeSubmitEvent] class.
22-
extension BeforeSubmitEventExtension on BeforeSubmitEvent {
12+
extension type BeforeSubmitEvent(JSObject _) {
2313
/// The name of the event.
2414
external String get eventName;
2515

2616
/// The ID of the form.
2717
external String get form;
2818

2919
/// An object containing a copy of the form data that is about to be sent.
30-
external Object? get formData;
20+
external JSAny? get formData;
3121

3222
/// The ID of the screen that is about to be loaded.
3323
external String? get nextScreen;
@@ -49,7 +39,7 @@ extension BeforeSubmitEventExtension on BeforeSubmitEvent {
4939
eventName,
5040
<String, dynamic>{
5141
'form': form,
52-
'formData': dartify(formData),
42+
'formData': formData.dartify(),
5343
'nextScreen': nextScreen,
5444
'profile': profile?.toMap(),
5545
'screen': screen,

0 commit comments

Comments
 (0)