Our state of the art Gantt chart

Post by akuang »

I'm trying to override total slack (and hence critical path) with our own backend calculation, but having trouble with the right generator incantation.

For this demo page:


I'm changing Task to look like:

class Task extends TaskModel {
    get cls() {
        // adds 'b-critical' CSS class to critical tasks
        return Object.assign(super.cls, {
            'b-critical': this.critical
    * calculateTotalSlack() {
        return yield*[0];

But I don 't see calculateTotalSlack being called, i.e. no console.log output.

Fwiw outside of the demo(
which AFAICT just doesn 't call calculateTotalSlack), in our own codebase, I'
ve tried this implementation in our TaskModel subclass,
and this method is actually called,
but then blows up with cryptic failures:

 * calculateTotalSlack() {
            const slack = this.blueprintTotalSlack || 0;
            return yield* slack; // this fails with undefined is not a function
            return yield*[
            ]; // this fails with this.graph[effect.handler] is not a function

Can you provide an example of overriding slack in the criticalpaths demo? And/or point out whats wrong with yield?


Last edited by akuang on Tue Feb 23, 2021 10:41 pm, edited 3 times in total.

Post by akuang »

The [code] syntax is continually screwing up the formatting of my post, and I'm going to stop trying to fix it, because it keeps breaking it. Hopefully you get the idea.

Post by akuang »

Nevermind, this works:

* calculateTotalSlack() {
    return 0;

Post Reply