-
Notifications
You must be signed in to change notification settings - Fork 362
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ModelBuilder: add
prototype.defineValueType
Add a shortcut for registering a new value type. The current implementation registers the type in the singleton registry `ModelBuilder.schemaTypes`. The API should allow us to to change the implementation to register the type in the scope of ModelBuilder instance only.
- Loading branch information
Miroslav Bajtoš
committed
May 23, 2014
1 parent
fc758ab
commit 487f7c8
Showing
1 changed file
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -432,6 +432,15 @@ ModelBuilder.prototype.defineProperty = function (model, propertyName, propertyD | |
this.models[model].registerProperty(propertyName); | ||
}; | ||
|
||
/** | ||
* Define a new value type that can be used in model schemas as a property type. | ||
* @param {function()} type Type constructor. | ||
* @param {string[]=} aliases Optional list of alternative names for this type. | ||
*/ | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
bajtos
Member
|
||
ModelBuilder.prototype.defineValueType = function(type, aliases) { | ||
ModelBuilder.registerType(type, aliases); | ||
}; | ||
|
||
/** | ||
* Extend existing model with bunch of properties | ||
* | ||
|
Maybe just call it defineType or registerType