ember-app-scheduler
Version:
Ember addon to schedule work at different phases of app life cycle.
79 lines • 1.94 kB
JavaScript
export class Constants {
constructor() {
// `0` means NULL
this.references = [];
this.strings = [];
this.expressions = [];
this.floats = [];
this.arrays = [];
this.blocks = [];
this.functions = [];
this.others = [];
}
getReference(value) {
return this.references[value - 1];
}
reference(value) {
let index = this.references.length;
this.references.push(value);
return index + 1;
}
getString(value) {
return this.strings[value - 1];
}
getFloat(value) {
return this.floats[value - 1];
}
float(value) {
return this.floats.push(value);
}
string(value) {
let index = this.strings.length;
this.strings.push(value);
return index + 1;
}
getExpression(value) {
return this.expressions[value - 1];
}
getArray(value) {
return this.arrays[value - 1];
}
getNames(value) {
let _names = [];
let names = this.getArray(value);
for (let i = 0; i < names.length; i++) {
let n = names[i];
_names[i] = this.getString(n);
}
return _names;
}
array(values) {
let index = this.arrays.length;
this.arrays.push(values);
return index + 1;
}
getBlock(value) {
return this.blocks[value - 1];
}
block(block) {
let index = this.blocks.length;
this.blocks.push(block);
return index + 1;
}
getFunction(value) {
return this.functions[value - 1];
}
function(f) {
let index = this.functions.length;
this.functions.push(f);
return index + 1;
}
getOther(value) {
return this.others[value - 1];
}
other(other) {
let index = this.others.length;
this.others.push(other);
return index + 1;
}
}