From 3667a15e8d4f5ce3a2c3c7676a7e49549f242d5c Mon Sep 17 00:00:00 2001 From: nightwing Date: Thu, 20 Jun 2013 18:04:36 +0400 Subject: [PATCH] add callback to setTheme as well --- lib/ace/virtual_renderer.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) 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(); } };