Skip to content

remove once from SingleInstancePromise #939

Description

@jespertheend

This seems useful at first. But you can really easily achieve the same effect with just a single promise:

const myAsyncObject = (async () => {
    // some code...
})();

// and then use this whenever you need it.
const theObject = await myAsyncObject;

Or if you only want to run it the moment you need it:

let promise = null;
function getAsyncObject() {
    if (promise) return promise;
    promise = (async () => {
        // some code...
    })();
    return promise;
}

We should get rid of once since it would remove a lot of unnecessary complexity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort: CasualSimple changes that shouldn't take too much time when you're already familiar with the codebase

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions