MCPcopy Create free account
hub / github.com/Easy-Editor/EasyEditor / init

Method init

packages/core/src/engine/editor.ts:133–152  ·  view source on GitHub ↗
(config?: EditorConfig, components?: Editor['components'])

Source from the content-addressed store, hash-verified

131 }
132
133 async init(config?: EditorConfig, components?: Editor['components']): Promise<any> {
134 this.config = config || {}
135 this.components = components || {}
136 const { hooks = [], lifeCycles } = this.config
137
138 this.emit(EDITOR_EVENT.BEFORE_INIT)
139 const init = (lifeCycles && lifeCycles.init) || ((): void => {})
140
141 try {
142 await init(this)
143 // 注册快捷键
144 // 注册 hooks
145 this.registerHooks(hooks)
146 this.emit(EDITOR_EVENT.AFTER_INIT)
147
148 return true
149 } catch (err) {
150 logger.error(err)
151 }
152 }
153
154 destroy() {
155 if (!this.config) {

Callers 1

constructorMethod · 0.95

Calls 3

initFunction · 0.70
emitMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected