<commit_before># booklet
A simple module initializer by creating view models.
The main attitude of this module binding system is inspired by <NAME>'s presentation here : http://www.slideshare.net/nzakas/scalable-javascript-application-architecture

###Usage

####Create a Booklet instance

<pre lang="javascript">
<code>
var app = new Booklet('app', {someOption : 'some options'});
</code>
</pre>

####Generate a Page instance by invoking createView method with a page name

<pre lang="javascript">
<code>
var page = app.createView('page');
</code>
</pre>

####Bind a module into the instance with an init method calling the inner functions

<pre lang="javascript">
<code>
page.register('testModule', {
	init : function () {
		this.someMethod();
	},
	someMethod : function () {
		console.log('someMethod initialized');
	}
});
</code>
</pre>

####Make the new module begin to work specifically mentioning its name

<pre lang="javascript">
<code>
page.start('testModule');
</code>
</pre>

####Or make the all modules begin to work

<pre lang="javascript">
<code>
page.startAll();
</code>
</pre>

###Creating Services for Page Instance

####Create a Page Service

<pre lang="javascript"><commit_msg>Added the Booklet service decleration into the readme file<commit_after># booklet
A simple module initializer by creating view models.
The main attitude of this module binding system is inspired by <NAME>'s presentation here : http://www.slideshare.net/nzakas/scalable-javascript-application-architecture

###Usage

####Create a Booklet instance

<pre lang="javascript">
<code>
var app = new Booklet('app', {someOption : 'some options'});
</code>
</pre>

####Generate a Page instance by invoking createView method with a page name

<pre lang="javascript">
<code>
var page = app.createView('page');
</code>
</pre>

####Bind a module into the instance with an init method calling the inner functions

<pre lang="javascript">
<code>
page.register('testModule', {
	init : function () {
		this.someMethod();
	},
	someMethod : function () {
		console.log('someMethod initialized');
	}
});
</code>
</pre>

####Make the new module begin to work specifically mentioning its name

<pre lang="javascript">
<code>
page.start('testModule');
</code>
</pre>

####Or make the all modules begin to work

<pre lang="javascript">
<code>
page.startAll();
</code>
</pre>

###Creating Services for Booklet Instance

####Create a Booklet Service

<pre lang="javascript">
<code>
app.createService('testService', function () {
   return 'testService invoked'
});
</code>
</pre>

####Invoke the Current Booklet Service

<pre lang="javascript">
<code>
page.register('menu', {
   init : function () {
      console.log(this.getServiceWorked()); //logs "testService invoked"
   },
   getServiceWorked : function () {
      var testService = app.getService('testService');
      return testService();
   }
})
</code>
</pre>

###Creating Services for Page Instance

####Create a Page Service

<pre lang="javascript">
{'fraction_non_alphanumeric': 0.14961422341496142, 'fraction_numerical': 0.0, 'mean_word_length': 4.975951903807616, 'pattern_counts': {'":': 0, '<': 55, '<?xml version=': 0, '>': 55, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1906008', 'n_tokens_mistral': 890, 'n_tokens_neox': 876, 'n_words': 312}