hudozka app added edit from 2018.02
This commit is contained in:
1 parent
6805e07434
commit
759f1217b5
57 files changed
+3630
-1247
No files matched your search
@@ -0,0 +1,51 @@
|
||||
export default class Token {
|
||||
static test(data) {
|
||||
return true
|
||||
}
|
||||
|
||||
constructor({name, data, component}) {
|
||||
this.name = name
|
||||
this.data = data
|
||||
this.component = component
|
||||
this.joinable = true
|
||||
|
||||
this.compiledData = null
|
||||
}
|
||||
|
||||
isJoinable() {
|
||||
return this.joinable
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this.compiledData) {
|
||||
throw new Error('Token not compiled. Call Token::compile before.')
|
||||
}
|
||||
return this.component(this.compiledData)
|
||||
}
|
||||
|
||||
async getData() {
|
||||
return this.data
|
||||
}
|
||||
|
||||
async compile() {
|
||||
this.compiledData = await this.getData()
|
||||
return this
|
||||
}
|
||||
|
||||
merge(token) {
|
||||
return this
|
||||
}
|
||||
|
||||
getMergeOptions(extend) {
|
||||
return {
|
||||
name: this.name,
|
||||
data: this.data,
|
||||
component: this.component,
|
||||
...extend,
|
||||
}
|
||||
}
|
||||
|
||||
toString() {
|
||||
return `[Token ${this.name} ${this.data}]`
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user