Change mode with vanilla JS

How is the mode supposed to be changed with vanilla JS?

The docs show how to do it with angular: https://ionicframework.com/docs/utilities/config#config-options