Skip to content

Commit

Permalink
milo-core extracted
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Feb 22, 2015
1 parent a93b9af commit 413f2de
Show file tree
Hide file tree
Showing 137 changed files with 6,616 additions and 15,260 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ http://opensource.org/licenses/BSD-2-Clause

Changes log
-----------

###0.1.10###
- `Messenger` performance improvement
- `MLSuperCombo` support for remote list of options
Expand Down
2 changes: 1 addition & 1 deletion lib/abstract/facet.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';


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

module.exports = Facet;

Expand Down
16 changes: 8 additions & 8 deletions lib/abstract/faceted_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@


var Facet = require('./facet')
, _ = require('mol-proto')
, check = require('../util/check')
, Match = check.Match
, FacetError = require('../util/error').Facet;
, miloCore = require('milo-core')
, _ = miloCore.proto
, check = miloCore.util.check
, Match = check.Match;

module.exports = FacetedObject;

Expand All @@ -31,7 +31,7 @@ function FacetedObject() {
// FacetedObject class itself is not meant to be instantiated - it has no facets
// It may change, as adding facets is possible to instances
if (this.constructor == FacetedObject)
throw new FacetError('FacetedObject is an abstract class, can\'t be instantiated');
throw new Error('FacetedObject is an abstract class, can\'t be instantiated');

// instantiate class facets
if (this.facetsClasses)
Expand Down Expand Up @@ -110,15 +110,15 @@ function FacetedObject$addFacet(FacetClass, facetConfig, facetName, throwOnError

// check that this facetName was not already used in the class
if (protoFacets && protoFacets[facetName])
throw new FacetError('facet ' + facetName + ' is already part of the class ' + this.constructor.name);
throw new Error('facet ' + facetName + ' is already part of the class ' + this.constructor.name);

// check that this faceName does not already exist on the faceted object
if (this[facetName]) {
var message = 'facet ' + facetName + ' is already present in object';
if (throwOnErrors === false)
return logger.error('FacetedObject addFacet: ', message);
else
throw new FacetError(message);
throw new Error(message);
}

// instantiate the facet
Expand Down Expand Up @@ -176,7 +176,7 @@ function FacetedObject$$createFacetedClass(name, facetsClasses, facetsConfig) {
if (facetsConfig)
_.eachKey(facetsConfig, function(fctConfig, fctName) {
if (! facetsClasses.hasOwnProperty(fctName))
throw new FacetError('configuration for facet (' + fctName + ') passed that is not in class');
throw new Error('configuration for facet (' + fctName + ') passed that is not in class');
});

// create subclass of the current class (this refers to the class that calls this method)
Expand Down
211 changes: 0 additions & 211 deletions lib/abstract/mixin.js

This file was deleted.

12 changes: 6 additions & 6 deletions lib/abstract/registry.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

var _ = require('mol-proto')
, RegistryError = require('../util/error').Registry
, check = require('../util/check')
var miloCore = require('milo-core')
, _ = miloCore.proto
, check = miloCore.util.check
, Match = check.Match;

module.exports = ClassRegistry;
Expand Down Expand Up @@ -58,10 +58,10 @@ function add(aClass, name) {
if (aClass != this.FoundationClass)
check(aClass, Match.Subclass(this.FoundationClass), 'class must be a sub(class) of a foundation class');
} else
throw new RegistryError('foundation class must be set before adding classes to registry');
throw new Error('foundation class must be set before adding classes to registry');

if (this.__registeredClasses[name])
throw new RegistryError('class "' + name + '" is already registered');
throw new Error('class "' + name + '" is already registered');

this.__registeredClasses[name] = aClass;
};
Expand Down Expand Up @@ -93,7 +93,7 @@ function remove(nameOrClass) {
: nameOrClass.name;

if (! this.__registeredClasses[name])
throw new RegistryError('class is not registered');
throw new Error('class is not registered');

delete this.__registeredClasses[name];
};
Expand Down
10 changes: 5 additions & 5 deletions lib/attributes/a_bind.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

var Attribute = require('./a_class')
, AttributeError = require('../util/error').Attribute
, config = require('../config')
, _ = require('mol-proto')
, check = require('../util/check')
, miloCore = require('milo-core')
, _ = miloCore.proto
, check = miloCore.util.check
, Match = check.Match;


Expand Down Expand Up @@ -87,7 +87,7 @@ function attrName() {
var bindTo = value.match(ATTRIBUTE_REGEXP);

if (! bindTo)
throw new AttributeError('invalid bind attribute ' + value);
throw new Error('invalid bind attribute ' + value);

this.compClass = bindTo[1] || 'Component';
this.compFacets = (bindTo[2] && bindTo[2].split(FACETS_SPLIT_REGEXP)) || undefined;
Expand All @@ -107,7 +107,7 @@ function validate() {
check(this.compName, Match.IdentifierString);

if (! this.compClass)
throw new AttributeError('empty component class name ' + this.compClass);
throw new Error('empty component class name ' + this.compClass);

return this;
}
Expand Down
13 changes: 9 additions & 4 deletions lib/attributes/a_class.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';

var _ = require('mol-proto')
, check = require('../util/check')
, Match = check.Match
, toBeImplemented = require('../util/error').toBeImplemented;
var miloCore = require('milo-core')
, _ = miloCore.proto
, check = miloCore.util.check
, Match = check.Match;


module.exports = Attribute;
Expand Down Expand Up @@ -111,3 +111,8 @@ function Attribute$set(value) {
function Attribute$decorate() {
this.set(this.render());
}


function toBeImplemented() {
throw new Error('calling the method of an absctract class');
}
3 changes: 1 addition & 2 deletions lib/attributes/a_load.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
'use strict';

var Attribute = require('./a_class')
, AttributeError = require('../util/error').Attribute
, config = require('../config')
, _ = require('mol-proto');
, _ = require('milo-core').proto;


/**
Expand Down
6 changes: 3 additions & 3 deletions lib/binder.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ var miloMail = require('./services/mail')
, ComponentInfo = require('./components/c_info')
, Scope = require('./components/scope')
, BindAttribute = require('./attributes/a_bind')
, BinderError = require('./util/error').Binder
, _ = require('mol-proto')
, check = require('./util/check')
, miloCore = require('milo-core')
, _ = miloCore.proto
, check = miloCore.util.check
, utilDom = require('./util/dom')
, Match = check.Match;

Expand Down
Loading

0 comments on commit 413f2de

Please sign in to comment.