Skip to content

Commit

Permalink
Merge pull request #51 from euforic/bug/TIMOB-14721
Browse files Browse the repository at this point in the history
[TIMOB-14721] LiveView: App.js Lexical Scope local vars not globally available
  • Loading branch information
Christian Sullivan committed Aug 7, 2013
2 parents 3c9cc29 + 2bfaaee commit d090150
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions lib/fserver.js
Expand Up @@ -15,7 +15,7 @@ var http = require('http')
, debug = require('debug')('liveview:server')
, pkgConf = require('../package')
, util = require('util')
, detect = require('lexical-scope');
, detect = require('jsparse-tools').lexscope;

var TMP_DIR = tempdir();
var PID = process.pid;
Expand Down Expand Up @@ -160,7 +160,7 @@ FServer.start = function(opts) {
return;
}

debug('Request Headers:', util.inspect(request.headers));
debug('Request Headers:', '\n', util.inspect(request.headers), '\n');

filename = (fs.existsSync(overridePath))
? overridePath
Expand Down Expand Up @@ -191,10 +191,11 @@ FServer.start = function(opts) {
: { code: 200, data: file };

debug('File Server Response',
'-REQUESTED:' + fileCount[filename] + 'times\n' +
'-FILE:' + uri.replace('/', '') + '\n' +
'-RESPONSE:' + out.code + '\n' +
'-LENGTH:' + out.data.length + '\n'
'\n' +
' requested: ' + fileCount[filename] + ' time(s)\n' +
' file: ' + uri.replace('/', '') + '\n' +
' response: ' + out.code + '\n' +
' length: ' + out.data.length + '\n'
);

response.writeHead(out.code, {
Expand All @@ -204,7 +205,7 @@ FServer.start = function(opts) {

if (uri === '/app.js') {
var scope = detect(out.data);
console.log(scope.locals['']);
debug('[LiveView] app.js global variables: ', scope.locals[''], '\n');
scope.locals[''].forEach(function(lexVar){
out.data = 'lvGlobal._globalCtx.' + lexVar + ' = ' + lexVar + '; ' + out.data;
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -52,7 +52,7 @@
"chokidar": "~0.6.2",
"coloring": "~0.1.0",
"debug": "~0.7.2",
"lexical-scope": "~0.0.14"
"jsparse-tools": "~0.0.1"
},
"devDependencies": {
"should": "~1.2.2",
Expand Down

0 comments on commit d090150

Please sign in to comment.