MCPcopy
hub / github.com/codex-team/editor.js / destroy

Method destroy

src/codex.ts:85–105  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

83 public exportAPI(editor: Core): void {
84 const fieldsToExport = [ 'configuration' ];
85 const destroy = (): void => {
86 Object.values(editor.moduleInstances)
87 .forEach((moduleInstance) => {
88 if (_.isFunction(moduleInstance.destroy)) {
89 moduleInstance.destroy();
90 }
91 moduleInstance.listeners.removeAll();
92 });
93
94 destroyTooltip();
95
96 editor = null;
97
98 for (const field in this) {
99 if (Object.prototype.hasOwnProperty.call(this, field)) {
100 delete this[field];
101 }
102 }
103
104 Object.setPrototypeOf(this, null);
105 };
106
107 fieldsToExport.forEach((field) => {
108 this[field] = editor[field];

Callers

nothing calls this directly

Calls 5

forEachMethod · 0.80
valuesMethod · 0.80
destroyMethod · 0.65
callMethod · 0.65
removeAllMethod · 0.45

Tested by

no test coverage detected