Skip to content

Feature request: injectScriptOnce #8

Description

@bantic

A pattern we commonly use is to use a utility function to inject a script (for example, the filestack SDK) and keep a reference to the promise, returning it for subsequent calls so that multiple script elements don't get added to the page.

Would you be interested in a PR that adds an injectScriptOnce function that uses a map to keep track of which URLs have already been injected, and return their existing promise instead of creating a new <script> tag?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions