Skip to content

Commit

Permalink
fixes issue/#2073: added Adapt.getViewClass (#2074)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverfoster authored May 25, 2018
1 parent 16ea719 commit 00c4fbe
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/core/js/adapt.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,10 @@ define([
Adapt.register = function(name, object) {
// Used to register components
// Store the component view
if (Adapt.componentStore[name])
if (Adapt.componentStore[name]) {
throw Error('The component "' + name + '" already exists in your project');

}

if (object.view) {
//use view+model object
if(!object.view.template) object.view.template = name;
Expand All @@ -223,6 +224,14 @@ define([
return object;
};

Adapt.getViewClass = function(name) {
var object = Adapt.componentStore[name];
if (!object) {
throw Error('The component "' + name + '" doesn\'t exist in your project');
}
return object.view || object;
};

// Used to map ids to collections
Adapt.setupMapping = function() {
// Clear any existing mappings.
Expand Down

0 comments on commit 00c4fbe

Please sign in to comment.