ember.js - How to transition to route in Ember from global context? -
i integrating chrome extension ember app. have chrome extension code in app.js file:
window.sendtoextension = (message, callback) => { chrome.runtime.sendmessage(extensionid, message, (response) => { console.log('got response extension!!', response) if (response.path) { //here need tell ember app transition given path } }) }
this
refers window
can't call this.transitionto
. how can transition route name extension has told me to?
i figured out!! had add beforemodel
hook application route did window.applicationrouteinstance = this
, can access globally, such in extension messaging code, applicationrouteinstance.transitionto(response.path)
also there's new app.visit api coming in 2.3
Comments
Post a Comment