Forbes Lindesay forbes at
Thu Aug 8 08:06:48 PDT 2013

How about just adding a parameter that tells you whether it was delayed for taking too long:

asap(function (tooLong) {
  if (tooLong) {
    //attempt to restore invariants here
  //do work here

And then follow @domenic's solution of just pushing it into the next macro-task if it's spent too long executing micro tasks.

That way users who didn't care about such invariants could just ignore that argument and those who do can choose how to handle it gracefully.

More information about the es-discuss mailing list