Skip to content

Schedule runnables to run once#10

Description

@krispya

An example is an init function. A work around is to early out after the first run, but it would be even better if it were just removed from the sort entirely.

I figure the API can look like this, though I don't know the best way it could be implemented.

test('scheduling runnables once', () => {
    const schedule = create();

    add(schedule, aFn, id('A'), once());
    add(schedule, bFn, after('A'), id('B'));
    add(schedule, cFn, after('B'), id('C'));

    run(schedule, {});

    expect(order).toEqual(['A', 'B', 'C']);

    order = [];
    run(schedule, {});

    expect(order).toEqual(['B', 'C']);
})

Metadata

Metadata

Assignees

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