diff options
Diffstat (limited to 'data/js/application.js')
-rw-r--r-- | data/js/application.js | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/data/js/application.js b/data/js/application.js index d0e7c649f..3118f96bb 100644 --- a/data/js/application.js +++ b/data/js/application.js @@ -1,22 +1,36 @@ (function () { 'use strict'; -define(['require', 'util', 'vendor'], function (require, Util) { - require(['script']); - var App = { - // Gets called for every request - initialize: function () { - this.setupLineHighlight(); - }, - // Gets called for every request on page load - onPageLoaded: function () { - Util.highlightLineFromHash(); - }, +define( + [ + 'require', + 'util', + 'lexer-input', + 'vendor' + ], + function (require, Util, LexerInput) { + require(['script']); + var App = { + // Gets called for every request (before page load) + initialize: function () { + this.setupLineHighlight(); + }, - setupLineHighlight: function () { - $(window).on('hashchange', Util.highlightLineFromHash); - } - }; + /* + * Gets called for every request after page load + * config contains app config attributes passed from php + */ + onPageLoaded: function (config) { + Util.highlightLineFromHash(); + LexerInput.initialize(config.lexers); + }, - return App; -}); + setupLineHighlight: function () { + $(window).on('hashchange', Util.highlightLineFromHash); + }, + + }; + + return App; + } +); })(); |