refactor: fix

This commit is contained in:
xiaojunnuo
2021-02-07 13:53:30 +08:00
parent baec15dfc6
commit 68c1eff81d
4 changed files with 11 additions and 8 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
export class Registry {
constructor () {
this.collection = new Map()
this.collection = {}
}
install (target) {
@@ -8,7 +8,7 @@ export class Registry {
return
}
if (this.collection == null) {
this.collection = new Map()
this.collection = {}
}
let defineName = target.define ? target.define().name : null
if (defineName == null) {
@@ -22,15 +22,15 @@ export class Registry {
if (!key || value == null) {
return
}
this.collection.set(key, value)
this.collection[key] = value
}
get (name) {
if (name) {
return this.collection.get(name)
return this.collection[name]
}
throw new Error(`${name} not found`)
throw new Error(`${name} cant blank`)
}
getCollection () {
+1 -1
View File
@@ -123,7 +123,7 @@ export class Executor {
}
deployTrace.set({ value: { status: 'success', remark: '执行成功' } })
trace.set({ type: 'result', value: { status: 'success', remark: '部署成功' } })
trace.set({ type: 'result', value: { status: 'success', remark: '执行成功' } })
} catch (e) {
deployTrace.set({ value: { status: 'error', remark: '执行失败:' + e.message } })
trace.set({ type: 'result', value: { status: 'error', remark: deployName + '执行失败:' + e.message } })