1
- import 'package:js/js.dart' ;
2
- import 'package:js/js_util.dart' ;
1
+ import 'dart:js_interop' ;
3
2
4
3
import '../../../models/screenset_event.dart' ;
5
4
import '../models/profile.dart' ;
6
5
7
- /// This typedef defines the function signature for the handler of the screenset before screen load event.
8
- ///
9
- /// This function should return false to cancel the next screen load or true to continue loading the screen.
10
- /// This function can also return a [Map] with a `nextScreen` key to override the default screenset flow,
11
- /// by showing a different screen in a specific scenario.
12
- typedef BeforeScreenLoadEventHandler = Object ? Function (ScreensetEvent event);
13
-
14
- /// The static interop class for the before screen load event of the `Account.showScreenset` event stream.
6
+ /// The extension type for the before screen load event of the `Account.showScreenset` event stream.
15
7
///
16
8
/// See: https://help.sap.com/docs/SAP_CUSTOMER_DATA_CLOUD/8b8d6fffe113457094a17701f63e3d6a/413a5b7170b21014bbc5a10ce4041860.html?locale=en-US#onbeforescreenload-event-data
17
9
@JS ()
18
10
@anonymous
19
11
@staticInterop
20
- class BeforeScreenLoadEvent {}
21
-
22
- /// This extension defines the static interop definition
23
- /// for the [BeforeScreenLoadEvent] class.
24
- extension BeforeScreenLoadEventExtension on BeforeScreenLoadEvent {
12
+ extension type BeforeScreenLoadEvent (JSObject _) {
25
13
/// The name of the current screen, before the screen switch.
26
14
external String get currentScreen;
27
15
28
- /// The site custom data fields related to the user, as known before the form submission.
29
- external Object ? get data;
16
+ /// The site custom data fields related to the user,
17
+ /// as known before the form submission.
18
+ external JSAny ? get data;
30
19
31
20
/// The name of the event.
32
21
external String get eventName;
@@ -41,7 +30,7 @@ extension BeforeScreenLoadEventExtension on BeforeScreenLoadEvent {
41
30
external Profile ? get profile;
42
31
43
32
/// The response of the previous screen's submit operation.
44
- external Object ? get response;
33
+ external JSAny ? get response;
45
34
46
35
/// The source plugin that generated this event.
47
36
/// The value of this field is the name of the plugin's API method,
@@ -54,11 +43,11 @@ extension BeforeScreenLoadEventExtension on BeforeScreenLoadEvent {
54
43
eventName,
55
44
< String , dynamic > {
56
45
'currentScreen' : currentScreen,
57
- 'data' : dartify (data ),
46
+ 'data' : data. dartify (),
58
47
'form' : form,
59
48
'nextScreen' : nextScreen,
60
49
'profile' : profile? .toMap (),
61
- 'response' : dartify (response ),
50
+ 'response' : response. dartify (),
62
51
'source' : source,
63
52
},
64
53
);
0 commit comments