35 lines
558 B
JavaScript
35 lines
558 B
JavaScript
|
import {Routine} from './routine';
|
||
|
|
||
|
export class Routines {
|
||
|
|
||
|
static type() {
|
||
|
return 'routines';
|
||
|
}
|
||
|
|
||
|
constructor() {
|
||
|
this.routines = {};
|
||
|
}
|
||
|
|
||
|
fromJSON(json) {
|
||
|
for (const i in json.routines) {
|
||
|
this.routines[i] = (new Routine()).fromJSON(json.routines[i]);
|
||
|
}
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
routine(index) {
|
||
|
return this.routines[index];
|
||
|
}
|
||
|
|
||
|
toJSON() {
|
||
|
const routines = {};
|
||
|
for (const i in this.routines) {
|
||
|
routines[i] = this.routines[i].toJSON();
|
||
|
}
|
||
|
return {
|
||
|
type: 'routines',
|
||
|
routines,
|
||
|
};
|
||
|
}
|
||
|
}
|