A fairly simple command queue that ensures both commands containing sync code and commands containing async code are executed in sequence, through promises chaining.