diff --git a/lib/ace/virtual_renderer.js b/lib/ace/virtual_renderer.js index 8449b958..e8aca1ff 100644 --- a/lib/ace/virtual_renderer.js +++ b/lib/ace/virtual_renderer.js @@ -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(); } };