@@ -74,21 +74,32 @@ class DataSourceManager extends EventEmitter {
74
74
} ) ;
75
75
76
76
const dataSourceList = Array . from ( this . dataSourceMap ) ;
77
- Promise . allSettled < Record < string , any > > ( dataSourceList . map ( ( [ , ds ] ) => this . init ( ds ) ) ) . then ( ( values ) => {
78
- const data : DataSourceManagerData = { } ;
79
- const errors : Record < string , Error > = { } ;
80
-
81
- values . forEach ( ( value , index ) => {
82
- const dsId = dataSourceList [ index ] [ 0 ] ;
83
- if ( value . status === 'fulfilled' ) {
84
- data [ dsId ] = this . data [ dsId ] ;
85
- } else if ( value . status === 'rejected' ) {
86
- errors [ dsId ] = value . reason ;
87
- }
88
- } ) ;
89
77
90
- this . emit ( 'init' , data , errors ) ;
91
- } ) ;
78
+ if ( typeof Promise . allSettled === 'function' ) {
79
+ Promise . allSettled < Record < string , any > > ( dataSourceList . map ( ( [ , ds ] ) => this . init ( ds ) ) ) . then ( ( values ) => {
80
+ const data : DataSourceManagerData = { } ;
81
+ const errors : Record < string , Error > = { } ;
82
+
83
+ values . forEach ( ( value , index ) => {
84
+ const dsId = dataSourceList [ index ] [ 0 ] ;
85
+ if ( value . status === 'fulfilled' ) {
86
+ data [ dsId ] = this . data [ dsId ] ;
87
+ } else if ( value . status === 'rejected' ) {
88
+ errors [ dsId ] = value . reason ;
89
+ }
90
+ } ) ;
91
+
92
+ this . emit ( 'init' , data , errors ) ;
93
+ } ) ;
94
+ } else {
95
+ Promise . all < Record < string , any > > ( dataSourceList . map ( ( [ , ds ] ) => this . init ( ds ) ) )
96
+ . then ( ( ) => {
97
+ this . emit ( 'init' , this . data ) ;
98
+ } )
99
+ . catch ( ( ) => {
100
+ this . emit ( 'init' , this . data ) ;
101
+ } ) ;
102
+ }
92
103
}
93
104
94
105
public async init ( ds : DataSource ) {
0 commit comments