Introduce the view_state object to ECMAScript with properties .uri and .plain and pass the current view_state to preformat hooks.