You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.3 KiB

import State from './_state.ts'
/**
* Docket
*
* Is used to hold all data and configs that run through the actions
*
* @author Björn Hase <me@herr-hase.wtf>
* @license http://opensource.org/licenses/MIT The MIT License
* @link https://git.node001.net/HerrHase/super-hog.git
*
*/
class Docket {
// config for action
private config: object
// data
private data: object
private options: object
private db: object
private states: array
/**
*
*
* @param object config
*
*/
public constructor(config: object, db: object) {
this.config = config
this.db = db
this.states = []
}
public getData() {
return this.data
}
public setData(data: object) {
return this.data = data
}
public setOptions(options): object {
this.options = options
}
public getConfig(): object {
return this.config
}
public getDb(): object {
return this.db
}
public addState(value: State) {
this.states.push(value)
}
public hasState(value: State) {
let result = false
for (let index in this.states) {
if (this.states[index] == value) {
result = true
break
}
}
return result
}
}
export default Docket