Skip to content

Commit

Permalink
Refactor.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ramon Barros committed May 22, 2016
1 parent ece85fd commit c7130db
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion src/AndLog.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@
} else {
window.console = out;
}
}(window));
}(this));
10 changes: 5 additions & 5 deletions src/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
this.env = 'local';

if (Url.host === 'localhost' || /192\.168\.1/.test(Url.host) || /.dev/.test(Url.host)) {
localStorage.debug = true;
window.localStorage.debug = true;
} else {
delete localStorage.debug;
delete window.localStorage.debug;
this.env = 'prod';
}
return this.__constructor();
Expand Down Expand Up @@ -108,7 +108,7 @@
}
//var expirationMS = expirationMin * 60 * 1000;
var record = { value: JSON.stringify(jsonData), timestamp: new Date().getTime() + expirationMS };
localStorage.setItem(key, JSON.stringify(record));
window.localStorage.setItem(key, JSON.stringify(record));
return jsonData;
};

Expand All @@ -121,7 +121,7 @@
if (typeof (Storage) === 'undefined') {
return false;
}
var record = JSON.parse(localStorage.getItem(key));
var record = JSON.parse(window.localStorage.getItem(key));
if (!record) {
return false;
}
Expand All @@ -131,6 +131,6 @@
window.Config = new Config();
return Config;

}(window));
}(this));


6 changes: 3 additions & 3 deletions src/Core.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright (c) 2016 Ramon Barros
*/
/* jslint devel: true, unparam: true, indent: 2 */
/* global window, FormData,Url,EventListener, View, Router */
/* global window, jQuery, FormData,Url,EventListener, View, Router */
// @import "AndLog.js";
// @import "FormData.js";
// @import "Url.js";
Expand All @@ -15,7 +15,7 @@
// @import "Config.js";
// @import "View.js";
// @import "Router.js";
(function (window) {
(function (window, $) {
'use strict';

/**
Expand Down Expand Up @@ -340,6 +340,6 @@

return Core;

}(window));
}(this, jQuery));


2 changes: 1 addition & 1 deletion src/EventListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@
window.EventListener = new EventListener();
return EventListener;

}(window));
}(this));


2 changes: 1 addition & 1 deletion src/Exceptions.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@
window.Exceptions = new Exceptions();
return Exceptions;

}(window));
}(this));
2 changes: 1 addition & 1 deletion src/FormData.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
return body;
};
w.FormData = FormData;
}(window));
}(this));
2 changes: 1 addition & 1 deletion src/Router.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,6 @@
window.Router = Router;
return Router;

}(window));
}(this));


2 changes: 1 addition & 1 deletion src/Slim.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@
window.$app = new Slim();
return window.$app;

}(window));
}(this));


2 changes: 1 addition & 1 deletion src/Url.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,4 @@
window.Url = new Url();
return Url;

}(window));
}(this));
4 changes: 2 additions & 2 deletions src/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Copyright (c) 2016 Ramon Barros
*/
/* jslint devel: true, unparam: true, indent: 2 */
/* global twig */
/* global jQuery, twig */
(function (window, $) {
'use strict';

Expand Down Expand Up @@ -64,6 +64,6 @@
window.View = new View();
return View;

}(window, jQuery));
}(this, jQuery));


6 changes: 3 additions & 3 deletions test/View.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
test('Set data view', function() {
expect(2);
equal(View.setData('foo', 'bar'), View);
equal(View.data, {"foo":"bar"});
equal(JSON.stringify(View.data), '{"foo":"bar"}');
});

test('Render view', function() {
expect(2);
equal(View.render('test.twig', null, true), "");
expect(1);
equal(View.render('test.twig', {foo: "bar"}, true), "bar");
});

}(jQuery));
6 changes: 3 additions & 3 deletions test/test.twig
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{% for x in [1, 2, 3] %}
- {{x}}
{% endfor %}
{% if foo is defined %}
{{foo}}
{% endif %}

0 comments on commit c7130db

Please sign in to comment.