Skip to content
This repository has been archived by the owner on Jun 1, 2021. It is now read-only.

Commit

Permalink
Wrap phantomjs script loading ina function, use strict
Browse files Browse the repository at this point in the history
  • Loading branch information
joelpurra committed Nov 30, 2013
1 parent f991fe9 commit 218915b
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions extract-field-info.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
;

// Load dependencies
{
// Hide cosole logging during libray loading
(function() {
"use strict";
var noop = function() {},
originalConsoleLog = console.log;

originalConsoleLog = console.log,

injectOrFail = function(path) {
var result = phantom.injectJs(path);

if (result !== true) {
throw new Error("Could not inject " + path);
}
}

// Hide console logging during libary loading
console.log = noop;

// Until a fully functioning require(...) is implemented
phantom.injectJs("lib/underscore-min.js");
phantom.injectJs("lib/q.min.js");
injectOrFail("lib/underscore-min.js");
injectOrFail("lib/q.min.js");

// Restore console logging
console.log = originalConsoleLog;
}
}());

(function(global, _) {
"use strict";

var defaults = {
debugLevel: 4,
scripts: ["lib/jquery-2.0.3.min.js", "lib/underscore-min.js", "lib/formfieldinfo.joelpurra.js"],
Expand Down

0 comments on commit 218915b

Please sign in to comment.