Util to make scripted event sequence less of a JS mess