@@ -5,9 +5,9 @@ import type {TaroPage, CustomRoutes} from '../_util/typings'
5
5
6
6
function isAbsoluteUrl ( url ?: string ) : boolean {
7
7
if ( ! url ) {
8
- return false ;
8
+ return false
9
9
}
10
- return / ^ ( [ a - z ] [ a - z \d \ +\- \ .] * : ) ? \/ \/ / i. test ( url ) ;
10
+ return / ^ ( [ a - z ] [ a - z \d + \- . ] * : ) ? \/ \/ / i. test ( url )
11
11
}
12
12
13
13
class TaroApp {
@@ -39,8 +39,8 @@ class TaroApp {
39
39
40
40
navigateTo : typeof swan . navigateTo = ( { url, success, fail, complete} ) => {
41
41
if ( ! Router . router ) {
42
- fail ( )
43
- complete ( )
42
+ fail ?. ( )
43
+ complete ?. ( )
44
44
return
45
45
}
46
46
@@ -62,31 +62,31 @@ class TaroApp {
62
62
route : urlObj . pathname
63
63
}
64
64
this . pageStack . push ( page )
65
- success ( )
65
+ success ?. ( )
66
66
} )
67
67
. catch ( fail )
68
68
. finally ( complete )
69
69
}
70
70
71
71
navigateBack : typeof swan . navigateBack = ( { success, fail, complete} ) => {
72
72
if ( ! Router . router ) {
73
- fail ( )
74
- complete ( )
73
+ fail ?. ( )
74
+ complete ?. ( )
75
75
return
76
76
}
77
77
78
78
// Next.js internal router apis aren't support to go back twice or many times.
79
79
// https://github.com/vercel/next.js/discussions/18333
80
80
Router . router . back ( )
81
81
this . pageStack . pop ( )
82
- success ( )
83
- complete ( )
82
+ success ?. ( )
83
+ complete ?. ( )
84
84
}
85
85
86
86
redirectTo : typeof swan . redirectTo = ( { url, complete, fail, success} ) => {
87
87
if ( ! Router . router ) {
88
- fail ( )
89
- complete ( )
88
+ fail ?. ( )
89
+ complete ?. ( )
90
90
return
91
91
}
92
92
@@ -105,16 +105,16 @@ class TaroApp {
105
105
}
106
106
this . pageStack . pop ( )
107
107
this . pageStack . push ( page )
108
- success ( )
108
+ success ?. ( )
109
109
} )
110
110
. catch ( fail )
111
111
. finally ( complete )
112
112
}
113
113
114
114
reLaunch : typeof swan . reLaunch = ( { url, complete, fail, success} ) => {
115
115
if ( ! Router . router ) {
116
- fail ( )
117
- complete ( )
116
+ fail ?. ( )
117
+ complete ?. ( )
118
118
return
119
119
}
120
120
@@ -132,7 +132,7 @@ class TaroApp {
132
132
route : urlObj . pathname
133
133
}
134
134
this . pageStack = [ page ]
135
- success ( )
135
+ success ?. ( )
136
136
} )
137
137
. catch ( fail )
138
138
. finally ( complete )
0 commit comments