Toggle function or promise first