MCPcopy
hub / github.com/marktext/marktext / dispatch

Method dispatch

packages/muya/src/state/index.ts:124–136  ·  view source on GitHub ↗
(op: JSONOp, source = 'user' /* user, api */)

Source from the content-addressed store, hash-verified

122 }
123
124 dispatch(op: JSONOp, source = 'user' /* user, api */) {
125 const prevDoc = this.getState();
126 this.apply(op);
127 // TODO: remove doc in future
128 const doc = this.getState();
129 debug.log(JSON.stringify(op));
130 this.muya.eventCenter.emit('json-change', {
131 op,
132 source,
133 prevDoc,
134 doc,
135 });
136 }
137
138 getState(): TState[] {
139 return deepClone(this._state);

Callers 1

updateContentsMethod · 0.45

Calls 3

getStateMethod · 0.95
applyMethod · 0.95
emitMethod · 0.80

Tested by

no test coverage detected