Skip to content

Commit dfa040f

Browse files
committed
new example
1 parent ce53a6b commit dfa040f

File tree

5 files changed

+43
-0
lines changed

5 files changed

+43
-0
lines changed

isomorphic/controllers/default.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
exports.install = function() {
2+
F.route('/');
3+
4+
setTimeout(function() {
5+
// EXAMPLE
6+
console.log(isomorphic.test.getName());
7+
}, 1000);
8+
};

isomorphic/definitions/merge.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
// EXAMPLE FOR MERGING
2+
// F.merge('/merge.js', '/js/your-script.js', '#test'); // #test is name of isomorphic file

isomorphic/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
require('total.js').http('debug');

isomorphic/isomorphic/test.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
exports.url = '/test.js';
2+
3+
exports.getName = function() {
4+
// is_server
5+
return 'CODE called from ' + (is_client ? 'client' : 'server');
6+
};

isomorphic/views/index.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@{layout('')}
2+
3+
<!DOCTYPE html>
4+
<html>
5+
<head>
6+
@{meta}
7+
<meta charset="utf-8" />
8+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
9+
<meta name="format-detection" content="telephone=no" />
10+
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no" />
11+
<meta name="robots" content="all,follow" />
12+
@{head}
13+
<!-- ISOMORPHIC according to /isomorphic/test/exports.url -->
14+
<script src="/test.js"></script>
15+
</head>
16+
<body>
17+
18+
<h1>total.js</h1>
19+
<div>ISOMORPHIC: <b>@{isomorphic.test.getName()}</b></div>
20+
21+
<script>
22+
alert(isomorphic.test.getName());
23+
</script>
24+
25+
</body>
26+
</html>

0 commit comments

Comments
 (0)