Skip to content

Conversation

inlined
Copy link
Member

@inlined inlined commented Mar 2, 2024

Adds a new function that can be used at global scope to perform initialization in production that won't be called during discovery. In this function, params will be guaranteed to have actual values.

Usage:

const apiKey = params.defineSecret("API_KEY");

onInit(() => {
  someSDK.init(apiKey.value);
});

@inlined inlined requested a review from blidd-google March 2, 2024 01:42
Copy link
Contributor

@blidd-google blidd-google left a comment

Choose a reason for hiding this comment

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

LGTM

import * as logger from "../logger";

let initCallback: (() => unknown) | null = null;
let didInit = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we leave globals as camel-cased or in CAPS?

Copy link
Member Author

Choose a reason for hiding this comment

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

Typically CAPS is for consts, which these aren't

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