Asynchronous reset of js