ActiveClass
Terminology
In Fireactive, 'ActiveClass' can refer both to:
- an ES6 Class that is used to interact with a particular store of entities; and
- the library export,
ActiveClass
that is used in the creation of these ActiveClasses.
More concretely:
- JavaScript
- TypeScript
In the above code, Animal
is an ActiveClass. It represents animal entities: JavaScript objects that have both a name
property (as a string) and an age
property (as a number).
It has been created by extending the ActiveClass
export (passed a Schema).
API
The basic API is simply:
Parameters
schema
(object): a Fireactive Schema
Examples
Basic ActiveClass
A basic ActiveClass simply extends ActiveClass(schema) {}
, without adding any further methods.
This will give it access to the default static and prototype methods.
- JavaScript
- TypeScript
Extending: prototype / instance methods
Since we are just creating an ES6 class, you can add your own prototype / instance methods or getters in the same way that you would with a typical ES6 class.
- JavaScript
- TypeScript
Extending: static methods
Since we are just creating an ES6 class, you can also add your own static / class methods that you would with a typical ES6 class.
- JavaScript
- TypeScript