File tree Expand file tree Collapse file tree 6 files changed +16
-8
lines changed
packages/optimizely-sdk/lib Expand file tree Collapse file tree 6 files changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -67,8 +67,9 @@ export class SingleEventQueue<K> implements EventQueue<K> {
6767 this . sink = sink
6868 }
6969
70- start ( ) : void {
70+ start ( ) : Promise < any > {
7171 // no-op
72+ return Promise . resolve ( )
7273 }
7374
7475 stop ( ) : Promise < any > {
@@ -114,9 +115,11 @@ export class DefaultEventQueue<K> implements EventQueue<K> {
114115 this . started = false
115116 }
116117
117- start ( ) : void {
118+ start ( ) : Promise < any > {
118119 this . started = true
119120 // dont start the timer until the first event is enqueued
121+
122+ return Promise . resolve ( ) ;
120123 }
121124
122125 stop ( ) : Promise < any > {
Original file line number Diff line number Diff line change 1414 * limitations under the License.
1515 */
1616export interface Managed {
17- start ( ) : void
17+ start ( ) : Promise < any >
1818
1919 stop ( ) : Promise < any >
2020}
Original file line number Diff line number Diff line change @@ -205,7 +205,7 @@ export class LogTierV1EventProcessor implements EventProcessor {
205205 }
206206
207207 public async start ( ) : Promise < void > {
208- this . queue . start ( )
208+ await this . queue . start ( )
209209 this . unsubscribeNetInfo = addConnectionListener ( this . connectionListener . bind ( this ) )
210210
211211 await this . processPendingEvents ( )
Original file line number Diff line number Diff line change @@ -97,6 +97,6 @@ export class LogTierV1EventProcessor implements EventProcessor {
9797 }
9898
9999 async start ( ) : Promise < void > {
100- this . queue . start ( )
100+ await this . queue . start ( )
101101 }
102102}
Original file line number Diff line number Diff line change @@ -179,12 +179,15 @@ export default class Optimizely implements Client {
179179
180180 const eventProcessorStartedPromise = this . eventProcessor . start ( ) ;
181181
182- const dependentPromises : Array < Promise < any > | void > = [
182+ const dependentPromises : Array < Promise < any > > = [
183183 projectConfigManagerReadyPromise ,
184184 eventProcessorStartedPromise ,
185- config . odpManager ?. initPromise ,
186185 ] ;
187186
187+ if ( config . odpManager ?. initPromise ) {
188+ dependentPromises . push ( config . odpManager . initPromise ) ;
189+ }
190+
188191 this . readyPromise = Promise . all ( dependentPromises ) . then ( promiseResults => {
189192 // If no odpManager exists yet, creates a new one
190193 if ( config . odpManager != null ) {
Original file line number Diff line number Diff line change @@ -44,7 +44,9 @@ class ForwardingEventProcessor implements EventProcessor {
4444 }
4545 }
4646
47- start ( ) : void { }
47+ start ( ) : Promise < any > {
48+ return Promise . resolve ( ) ;
49+ }
4850
4951 stop ( ) : Promise < unknown > {
5052 return Promise . resolve ( ) ;
You can’t perform that action at this time.
0 commit comments