Skip to content

Braze: Enhancement - Refactor to ensure single SDK initialization#2140

Open
cmgustavo wants to merge 1 commit intobitpay:developfrom
cmgustavo:feat/braze-wrapper-single-initialization-01
Open

Braze: Enhancement - Refactor to ensure single SDK initialization#2140
cmgustavo wants to merge 1 commit intobitpay:developfrom
cmgustavo:feat/braze-wrapper-single-initialization-01

Conversation

@cmgustavo
Copy link
Copy Markdown
Member

No description provided.

Comment thread src/lib/Braze/index.ts
}

async screen(name: string, properties: Record<string, any> = {}) {
if (!(await this.ensureReady())) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use if (!this.isReady()) { here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Differences with isReady is that ensureReady tries to initialize SDK with initPromise. It's a way to re-initialize if there was error during the startup (using screen/tracker events)

Comment thread src/lib/Braze/index.ts
}

async track(eventName: string, properties: Record<string, any> = {}) {
if (!(await this.ensureReady())) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use if (!this.isReady()) { here

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants