-
Notifications
You must be signed in to change notification settings - Fork 17
Developer documentation
romaintailhurat edited this page Oct 12, 2015
·
11 revisions
#Notes:
- When editing the questionnaire, it will be necessary to create 'pending' components, for example a component can be referenced in a control while it is not yet created. For this, a special component group will be created and attached to the questionnaire. This group will have the reserved id 'PENDING_COMPONENTS'.
#References:
- Airbnb ES6 style guide and React style guide
- Thinking in React
#Tools of the trade:
- DefiantJS : XPath for JSON objects. [Status : PENDING]
- ESDoc : documentation tool for Javascript code [Status : PENDING]
#How tos ##React
A clean way to document a React component is to start its declaration with the propTypes
object, making all the usable props explicit. And by the way, it allows props validation.
var Player = React.createClass({
propTypes : {
name: React.PropTypes.string,
isInjured: React.PropTypes.boolean,
getStats: React.PropTypes.func
}
// more
});
React.render(
<Player name="Lebron James" isInjured=false getStats={getStats.bind(null, "James")} />,
document.getElementById('player'));
See the official documentation. ##Logging For logging purposes, we recommend using our custom logger.
Using it is simple as:
var Logger = require('../logger/Logger');
var logger = new Logger('Script', 'Module');
logger.info('hello!') // in the browser console --> [Module][Script] hello!
logger.debug('see my beautiful object', {k:'v'}, ':)');
This logger uses the Config file to actively determine if logging instructions in scripts in a module must be processed. If the module or namespace of a script is not in Config.log.activeNamespaces, then logging will not happen.