Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Non-tail constructor form of instantiating is the default now in all …

…examples

Just making learning material more readable.
  • Loading branch information...
commit 13154d2ffb939e062cceb4bf18eb9e869b502682 1 parent f87d43e
jordan authored
Showing with 36 additions and 40 deletions.
  1. +36 −40 projectManager/stockResources/mainModuleTemplate.js
View
76 projectManager/stockResources/mainModuleTemplate.js
@@ -1,56 +1,52 @@
-var F = require('Fax'), FDom = require('FDom'), MainModuleName = {};
+var F = require('Fax'),
+ FDom = require('FDom'),
+ Div = FDom.Div;
-/* 'using(x)' allows "tail constructors" to be used for every component defined
- * inside module 'x'. Tail constructors look like: { content: 'hi' }.Div() */
-F.using(MainModuleName, FDom);
+var PersonDisplayer = F.Componentize({
+ structure: function() {
+ return Div({
+ classSet: { personDisplayerContainer: true},
+
+ titleDiv: Div({
+ classSet: { personNameTitle: true },
+ content: this.props.name
+ }),
+
+ nestedAgeDiv: Div({
+ content: 'Interests: ' + this.props.interests
+ }),
+
+ ageDiv: Div({
+ content: 'Age: ' + this.props.age
+ })
+ });
+ }
+});
-/* The project was created with an index.html that instantiates
- * MainModuleName.MainComponent. 'structure()' is the main method of any ui
- * component. It declares what the component 'looks like' - how it's composed.*/
-MainModuleName.MainComponent = {
+/* The project was created with an index.html that instantiates a MainComponent.
+ * 'structure()' is the main method of any ui component. It declares what the
+ * component 'looks like' - how it's composed.*/
+var MainComponent = exports.MainComponent = F.Componentize({
structure: function() {
- return {
- firstPerson: {
+ return Div({
+ firstPerson: PersonDisplayer({
name: 'Joe Johnson', age: 31,
interests: 'hacking, eating, sleeping'
- }.PersonDisplayer(),
+ }),
- secondPerson: {
+ secondPerson: PersonDisplayer({
name: 'Sally Smith', age: 29,
interests: 'biking, cooking swiming'
- }.PersonDisplayer(),
+ }),
- thirdPerson: {
+ thirdPerson: PersonDisplayer({
name: 'Greg Winston', age: 25,
interests: 'design and technology'
- }.PersonDisplayer()
- }.Div();
+ })
+ });
}
-};
-
-MainModuleName.PersonDisplayer = {
- structure: function() {
- return {
- classSet: { personDisplayerContainer: true},
-
- titleDiv: {
- classSet: { personNameTitle: true },
- content: this.props.name
- }.Div(),
-
- nestedAgeDiv: {
- content: 'Interests: ' + this.props.interests
- }.Div(),
-
- ageDiv: {
- content: 'Age: ' + this.props.age
- }.Div()
- }.Div();
- }
-};
+});
-// Exports and componentizes all members of MainModuleName
-module.exports = F.ComponentizeAll(MainModuleName);
// Style object automatically converted into a css file.
module.exports.styleExports = {
Please sign in to comment.
Something went wrong with that request. Please try again.