@@ -3,41 +3,42 @@ export default class LaunchpadUtils {
3
3
public static crossAppNavigate ( sSemObject : string , sAction : string , oParams : object , sAppend ?: string ) {
4
4
if ( typeof window !== 'undefined' && window . hasOwnProperty ( 'sap' ) ) {
5
5
// @ts -ignore
6
- let oCrossAppNavigator = sap . ushell . Container . getService ( "CrossApplicationNavigation" ) ;
7
- let hash =
8
- ( oCrossAppNavigator &&
9
- oCrossAppNavigator . hrefForExternal ( {
6
+ sap . ushell . Container . getServiceAsync ( "CrossApplicationNavigation" ) . then ( function ( oService ) {
7
+ let hash =
8
+ ( oService &&
9
+ oService . hrefForExternal ( {
10
10
target : {
11
11
semanticObject : sSemObject ,
12
12
action : sAppend ? sAction + sAppend : sAction ,
13
13
} ,
14
14
params : oParams ,
15
15
} ) ) || "" ;
16
- let sintent = "#" + sSemObject + "=" + sAction ;
16
+ let sintent = "#" + sSemObject + "=" + sAction ;
17
17
18
- oCrossAppNavigator . isintentSupported ( [ sintent ] ) . done (
19
- function ( olntentSupported : object ) {
20
- // @ts -ignore
21
- if (
22
- olntentSupported &&
23
- // @ts -ignore
24
- olntentSupported [ sIntent ] &&
18
+ oService . isIntentSupported ( [ sintent ] ) . done (
19
+ function ( olntentSupported : object ) {
25
20
// @ts -ignore
26
- olntentSupported [ sintent ] . supported === true
27
- ) {
28
- oCrossAppNavigator . toExternal ( {
29
- target : {
30
- shellHash : hash ,
31
- } ,
32
- } ) ;
33
- } else {
34
- console . error ( "Intent + sintent + is not supported" ) ;
35
- }
36
- } . bind ( this )
37
- ) ;
21
+ if (
22
+ olntentSupported &&
23
+ // @ts -ignore
24
+ olntentSupported [ sintent ] &&
25
+ // @ts -ignore
26
+ olntentSupported [ sintent ] . supported === true
27
+ ) {
28
+ oService . toExternal ( {
29
+ target : {
30
+ shellHash : hash ,
31
+ } ,
32
+ } ) ;
33
+ } else {
34
+ console . error ( "Intent " + sintent + " is not supported" ) ;
35
+ }
36
+ // @ts -ignore
37
+ } . bind ( this ) ) ;
38
+ } . bind ( this ) ) ;
38
39
}
39
40
else {
40
- console . log ( "you must work in fiori launchpad" )
41
+ console . log ( "You must work in fiori launchpad" )
41
42
}
42
43
}
43
44
}
0 commit comments