vendredi 6 mars 2015

Check if an ember-data model is a subclass of another model

How do I check if a class is a subclass of another given I only have access to the constructor not the instance?



//models/animal.js
export default DS.Model.extend({});

//models/dog.js
import Animal from './animal'
export default Animal.extend({});


Now I need to check if an object is of type Animal.



var Animal = store.modelFor('animal');
var Dog = store.modelFor('dog');

//fantasy method
Dog.isSubclassOf(Animal);


Is there a way to do this?





Aucun commentaire:

Enregistrer un commentaire