summaryrefslogtreecommitdiffstats
path: root/data/js/application.js
diff options
context:
space:
mode:
authorJoakim Reinert <mail@jreinert.com>2015-04-18 23:55:22 +0200
committerFlorian Pritz <bluewind@xinu.at>2015-05-05 12:21:26 +0200
commitfe68477d8b60bc9303dd2bcd542915ac05e3fac6 (patch)
tree341ca9d71423c21033cbe5d333603bd3f2e0c3ca /data/js/application.js
parent9f1fb6e1c8fbe2c54b5d9a7f0755557acd7ea84a (diff)
Refactor lexer input setup
Diffstat (limited to 'data/js/application.js')
-rw-r--r--data/js/application.js48
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;
+ }
+);
})();