-
Notifications
You must be signed in to change notification settings - Fork 6
Application structure overview
Kory Nunn edited this page Mar 28, 2014
·
2 revisions
Gaffa applications start with an instance of gaffa.
Gaffa can be obtained from NPM:
npm install gaffa
Then, in a javascript file, require gaffa, and create an instance:
var Gaffa = require('gaffa'),
gaffa = new Gaffa();
Gaffa applications are built from many small building blocks called viewItems.
viewItems fall into three categories:
- Views
- things you can see.
- Actions
- units of functionality that are triggered by either views or behaviours
- Behaviours
- anything that doesn't fit the above
Gaffa does not ship with any viewItems, instead, install them from npm, or in the unlikely case you need to, create your own.
eg:
var Textbox = require('gaffa-textbox');
Once you have obtained a viewItem constructor, you will want to register it with gaffa.
gaffa.registerConstructor(Textbox);
to create a view, simply new one up:
var myTextbox = new Textbox();
and to add it to the UI:
gaffa.views.add(myTextbox);
The above should be just enough code to put an input on your page.