Skip to content

Impossible to compose a lock.. #108

@mikegwhit

Description

@mikegwhit

when attempting to compose a release function, e.g. so that re-requesting the lock (if it exists) returns the release function, it fails stating:

TypeError: method is not a function

Example implementation:

        const release = getLock(file);
        let released = false;
        locks[file] = () => {
            if (!released) {
                released = true;
                release();
                delete locks[file];
            }
        };

Suspected cause: you're using function composition so that even with an arrow function, somehow scope is lost and method returns as undefined

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