This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* A module implementation to bind events and do something else independently | |
*/ | |
var module = (function () { | |
return function (elementType, methods) { | |
console.log(elementType); | |
console.log(methods); | |
} | |
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Person = function (name, age) { | |
this.name = name; | |
this.age = age; | |
} | |
function extend(destination, source) { | |
for (var k in source) { | |
if (source.hasOwnProperty(k)) { | |
destination[k] = source[k]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// models/Config.js | |
module.exports = (function () { | |
return function () { | |
var config = { | |
urls : { | |
tabs : { | |
address : '/#address', | |
payment : '/#payment' | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// base.js | |
var Config = require(‘models/Config’); | |
var configInstance = new Config(); | |
var config = configInstance.getConfig(); | |
configInstance = null; | |
$(‘.error).html(config.messages.errors.default); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileoverview The base object to generate modules | |
* @author hwclass | |
*/ | |
/** | |
* models/Module.js | |
* This object is used to generate some instances | |
* as modules to be attached into the MODULES array. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileoverview The base object to get configuration | |
* @author hwclass | |
*/ | |
/** | |
* models/Config.js | |
* This object is used to fetch needed configuration parameters | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileoverview The mediator object file | |
* @author hwclass | |
*/ | |
/** | |
* Mediator.js | |
* This object is used to fetch needed configuration parameters | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileoverview The sample js file that are thought that publishes the coming data from an API endpoint | |
* @author hwclass | |
*/ | |
/** | |
* ajax.js | |
* This file contains a publish command for productsFetchedEvent | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @fileoverview The sample js file for Person object | |
* @author hwclass | |
*/ | |
/** | |
* Person.js | |
* This file contains an object to be a reference for new instances | |
*/ | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<span data-bind="text : testText"></span> |