add callback to setTheme as well

This commit is contained in:
nightwing 2013-06-20 18:04:36 +04:00
commit 3667a15e8d

View file

@ -1257,10 +1257,10 @@ var VirtualRenderer = function(container, theme) {
/**
* [Sets a new theme for the editor. `theme` should exist, and be a directory path, like `ace/theme/textmate`.]{: #VirtualRenderer.setTheme}
* @param {String} theme The path to a theme
*
* @param {Function} cb optional callback
*
**/
this.setTheme = function(theme) {
this.setTheme = function(theme, cb) {
var _self = this;
this.$themeValue = theme;
_self._dispatchEvent('themeChange',{theme:theme});
@ -1274,7 +1274,7 @@ var VirtualRenderer = function(container, theme) {
function afterLoad(module) {
if (_self.$themeValue != theme)
return;
return cb && cb();
if (!module.cssClass)
return;
dom.importCssString(
@ -1303,7 +1303,8 @@ var VirtualRenderer = function(container, theme) {
_self.onResize();
}
_self._dispatchEvent('themeLoaded',{theme:module});
_self._dispatchEvent('themeLoaded', {theme:module});
cb && cb();
}
};