Native javascript message queue implementation