To run R:
Let A be the following steps:
Fire an event named "a".
"a"
Queue a microtask, given A.
To run S:
Let B be the following steps:
Fire an event named "b".
"b"
Queue a microtask, given B.