Skip to content

Commit

Permalink
milo-core used
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Feb 22, 2015
1 parent aaa4b30 commit a93b9af
Show file tree
Hide file tree
Showing 10 changed files with 3,947 additions and 1,840 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@ test_html/bind_test.bundle.js
docs/
npm-debug.log
bower_components

milo.min.js
milo.min.js.map
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
"laxbreak": true,
"browser": true,
"node": true
}
}
7 changes: 4 additions & 3 deletions lib/milo.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

var core = require('milo-core');
var _ = require('mol-proto');


Expand Down Expand Up @@ -47,9 +48,11 @@ function milo(func) {
* - [registry](./registry.js.html) - registries of fasets and components classes
*/
_.extend(milo, {
Messenger: core.Messenger,
Model: core.Model,
minder: core.minder,
loader: require('./loader'),
binder: require('./binder'),
minder: require('./minder'),
mail: require('./services/mail'),
window: require('./services/window'),
config: require('./config'),
Expand All @@ -58,8 +61,6 @@ _.extend(milo, {
attributes: require('./attributes'),
ComponentFacet: require('./components/c_facet'),
Component: require('./components/c_class'),
Messenger: require('./messenger'),
Model: require('./model'),
Command: require('./command'),
registry: require('./registry'),
milo_version: '0.1.4',
Expand Down
1 change: 1 addition & 0 deletions lib/util/storage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var DOMStorageError = require('../error').createClass('DomStorageError')
, check = require('../check')
, Match = check.Match;

require('./model')

module.exports = DOMStorage;

Expand Down
24 changes: 24 additions & 0 deletions lib/util/storage/model.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

var Model = require('milo-core').Model

Model.registerWithDOMStorage = Model$$registerWithDOMStorage;


function Model$$registerWithDOMStorage() {
var DOMStorage = require('./index');
DOMStorage.registerDataType('Model', Model_domStorageSerializer, Model_domStorageParser);
DOMStorage.registerDataType('ModelPath', Model_domStorageSerializer, Model_domStorageParser, 'Model');
}


function Model_domStorageSerializer(value) {
var data = value.get();
return JSON.stringify(data);
}


function Model_domStorageParser(valueStr) {
var data = _.jsonParse(valueStr);
return new Model(data);
}
Loading

0 comments on commit a93b9af

Please sign in to comment.