mirror of
https://github.com/NetEase/tango.git
synced 2026-08-29 02:01:34 +08:00
eae45003c6
* feat: refactor types * feat: rename models * fix: update types * fix: init workspace and viewNode * fix: update fileTypes * fix: update * fix: update
25 lines
679 B
TypeScript
25 lines
679 B
TypeScript
import { action, computed, makeObservable, observable, toJS } from 'mobx';
|
|
import type { IFileConfig } from '../types';
|
|
import { AbstractWorkspace } from './abstract-workspace';
|
|
import { AbstractJsonFile } from './abstract-json-file';
|
|
|
|
export class JsonFile extends AbstractJsonFile {
|
|
get json(): object {
|
|
return toJS(this._object);
|
|
}
|
|
|
|
constructor(workspace: AbstractWorkspace, props: IFileConfig) {
|
|
super(workspace, props);
|
|
makeObservable(this, {
|
|
_code: observable,
|
|
_cleanCode: observable,
|
|
_object: observable,
|
|
code: computed,
|
|
cleanCode: computed,
|
|
json: computed,
|
|
update: action,
|
|
setValue: action,
|
|
});
|
|
}
|
|
}
|