mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-22 23:27:54 -05:00
Give name to the exported module
This commit is contained in:
parent
3bfcb698e6
commit
7b704e878f
7 changed files with 21 additions and 17 deletions
|
@ -1,9 +1,9 @@
|
|||
var cookie = require('cookie');
|
||||
var xhr = require('xhr');
|
||||
|
||||
var module = module.exports = {};
|
||||
var Jar = {};
|
||||
|
||||
module.get = function (name, callback) {
|
||||
Jar.get = function (name, callback) {
|
||||
// Get cookie by name
|
||||
var obj = cookie.parse(document.cookie) || {};
|
||||
|
||||
|
@ -16,9 +16,9 @@ module.get = function (name, callback) {
|
|||
return obj[name];
|
||||
};
|
||||
|
||||
module.use = function (name, uri, callback) {
|
||||
Jar.use = function (name, uri, callback) {
|
||||
// Attempt to get cookie
|
||||
module.get(name, function (err, obj) {
|
||||
Jar.get(name, function (err, obj) {
|
||||
if (typeof obj !== 'undefined') return callback(null, obj);
|
||||
|
||||
// Make XHR request to cookie setter uri
|
||||
|
@ -31,9 +31,11 @@ module.use = function (name, uri, callback) {
|
|||
});
|
||||
};
|
||||
|
||||
module.set = function (name, value) {
|
||||
Jar.set = function (name, value) {
|
||||
var obj = cookie.serialize(name, value);
|
||||
var expires = '; expires=' + new Date(new Date().setYear(new Date().getFullYear() + 1)).toUTCString();
|
||||
var path = '; path=/';
|
||||
document.cookie = obj + expires + path;
|
||||
};
|
||||
|
||||
module.exports = Jar;
|
||||
|
|
|
@ -2,7 +2,7 @@ var ReactDOM = require('react-dom');
|
|||
var ReactIntl = require('react-intl');
|
||||
var IntlProvider = ReactIntl.IntlProvider;
|
||||
|
||||
module.exports = function (jsx, element) {
|
||||
var render = function (jsx, element) {
|
||||
// Get locale and messages from global namespace (see "init.js")
|
||||
var locale = window._locale;
|
||||
var messages = window._translations[locale];
|
||||
|
@ -21,3 +21,5 @@ module.exports = function (jsx, element) {
|
|||
window._renderedComponents.push(component);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = render;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
var Render = require('./lib/render.jsx');
|
||||
var render = require('./lib/render.jsx');
|
||||
|
||||
require('./main.scss');
|
||||
|
||||
var Navigation = require('./components/navigation/navigation.jsx');
|
||||
var Footer = require('./components/footer/footer.jsx');
|
||||
|
||||
Render(<Navigation />, document.getElementById('navigation'));
|
||||
Render(<Footer />, document.getElementById('footer'));
|
||||
render(<Navigation />, document.getElementById('navigation'));
|
||||
render(<Footer />, document.getElementById('footer'));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var React = require('react');
|
||||
var Render = require('../../lib/render.jsx');
|
||||
var render = require('../../lib/render.jsx');
|
||||
|
||||
require('./about.scss');
|
||||
|
||||
|
@ -14,4 +14,4 @@ var About = React.createClass({
|
|||
}
|
||||
});
|
||||
|
||||
Render(<About />, document.getElementById('view'));
|
||||
render(<About />, document.getElementById('view'));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var React = require('react');
|
||||
var Render = require('../../lib/render.jsx');
|
||||
var render = require('../../lib/render.jsx');
|
||||
|
||||
var Box = require('../../components/box/box.jsx');
|
||||
var Button = require('../../components/forms/button.jsx');
|
||||
|
@ -37,4 +37,4 @@ var Components = React.createClass({
|
|||
}
|
||||
});
|
||||
|
||||
Render(<Components />, document.getElementById('view'));
|
||||
render(<Components />, document.getElementById('view'));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var React = require('react');
|
||||
var Render = require('../../lib/render.jsx');
|
||||
var render = require('../../lib/render.jsx');
|
||||
|
||||
require('./hoc.scss');
|
||||
|
||||
|
@ -133,4 +133,4 @@ var Hoc = React.createClass({
|
|||
}
|
||||
});
|
||||
|
||||
Render(<Hoc />, document.getElementById('view'));
|
||||
render(<Hoc />, document.getElementById('view'));
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
var React = require('react');
|
||||
var Render = require('../../lib/render.jsx');
|
||||
var render = require('../../lib/render.jsx');
|
||||
|
||||
var Api = require('../../mixins/api.jsx');
|
||||
var Session = require('../../mixins/session.jsx');
|
||||
|
@ -73,4 +73,4 @@ var Splash = React.createClass({
|
|||
}
|
||||
});
|
||||
|
||||
Render(<Splash />, document.getElementById('view'));
|
||||
render(<Splash />, document.getElementById('view'));
|
||||
|
|
Loading…
Reference in a new issue