I decided to look through the appAPI object, to discover undocumented features.
I'm currently working on a project that will involve more developers (A team).
I really disliked the idea of having to either share a Crossrider account or somehow all the developers having to create a crossrider account and project to setup their own debug mode version.
What I found was that I could enable/disable Debug mode at will from within the extension. Untested in production mode, but anyways it's meant for staging mode.
This was really a big hurdle to get over ́, in my project, without this I might have needed to scrap Crossrider.
This allows you to install the Staging mode (Will probably work with Production also) as normally, and change to debug mode when needed. You can change back and forth as needed without having to go through the Crossrider IDE.
Usage:
Dev.setPath('http://localhost/'); //Setting path, Note: Make sure path exists, if not a valid path, you might have to reinstall extension to get access to it again.
Dev.setDebugMode(true); //Enable
Dev.setDebugMode(false); //Disable
//Additionally you can reload Background code by
Dev.loadBackground();
//And now you can also force an update (E.g in staging mode) on extension not running in the browser you are editing code in Crossrider IDE
Dev.update();
The following is most likely unsupported by Crossrider team, and should be used with caution, use at own risk
Dev: {
devPath: null,
endsWith: function(str,suffix) {
return str.indexOf(suffix, str.length - suffix.length) !== -1;
},
setPath: function(path) {
if(!Dev.endsWith(path,"/")) path += "/";
Dev.devPath = path;
appAPI.internal.db.set('debug_path',path);
appAPI.internal.db.set('debug_resources_path',path + 'resources/');
if(Dev.getDebugMode())
Dev.setDebugMode(true);
},
getPath: function(path) {
return appAPI.internal.db.get('debug_path');
},
setDebugMode: function(value) {
if(typeof(value) == 'undefined') value = true;
if(value) {
if(typeof(Dev.devPath) == 'undefined')
appAPI.internal.debug.turnOn(appAPI.internal.debug.getDebugUrl());
else
appAPI.internal.debug.turnOn({userCode:Dev.devPath + "extension.js", backgroundCode:Dev.devPath + "background.js"});
}
else {
appAPI.internal.debug.turnOff();
}
},
getDebugMode: function() {
return appAPI.internal.debug.isDebugMode();
},
loadBackground: function() {
appAPI.internal.reloadBackground();
},
update: function() {
appAPI.internal.forceUpdate();
}
}
Tested:
Currently Debugmode and loadBackground is only tested in FireFox.
And update is only tested in Chrome.
Setup a test project first, before using this in production/staging in development.
Also currently only tested in Extension.js scope, untested in Background and Popup scope.
Loading Profile...



Twitter,
Facebook, or email.

EMPLOYEE
