To run R:

  1. Let A be the following steps:

    1. Fire an event named "a".

  2. Queue a microtask, given A.

To run S:

  1. Let B be the following steps:

    1. Fire an event named "b".

  2. Queue a microtask, given B.