Skip to content

Commit b61765f

Browse files
committed
added options for beautify
1 parent 8e24460 commit b61765f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/ace/ext/beautify.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ exports.singletonTags = ["area", "base", "br", "col", "command", "embed", "hr",
4444
// insert a line break after block level tags
4545
exports.blockTags = ["article", "aside", "blockquote", "body", "div", "dl", "fieldset", "footer", "form", "head", "header", "html", "nav", "ol", "p", "script", "section", "style", "table", "tbody", "tfoot", "thead", "ul"];
4646

47-
exports.beautify = function(session) {
47+
exports.beautify = function(session, options = {useRequestAnimationFrame:false}) {
4848
var iterator = new TokenIterator(session, 0, 0);
4949
var token = iterator.getCurrentToken();
5050
var tabString = session.getTabString();
@@ -77,6 +77,7 @@ exports.beautify = function(session) {
7777
var levels = {0: 0};
7878
var parents = [];
7979
var caseBody = false;
80+
var id;
8081

8182
var trimNext = function() {
8283
if (nextToken && nextToken.value && nextToken.type !== 'string.regexp')
@@ -409,8 +410,8 @@ exports.beautify = function(session) {
409410

410411
token = nextToken;
411412
}
412-
var id;
413-
if(window.requestAnimationFrame){
413+
414+
if(options.useRequestAnimationFrame && window.requestAnimationFrame){
414415
id = requestAnimationFrame(function loop (){
415416
if(token !== null) {
416417
try{

0 commit comments

Comments
 (0)