2024-12-28 05:12:55 +08:00

68 lines
1.4 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import mitt from 'mitt';
import { reactive } from 'vue';
import { SkinManager } from './skin';
import { NetlistRender } from './render';
export const emitter = mitt();
export const globalSetting = reactive({
language: 'zh',
renderAnimation: true
});
export const globalLookup = reactive({
/**
* @type {SkinManager}
*/
skinManager: new SkinManager(),
/**
* @type {NetlistRender}
*/
netlistRender: new NetlistRender(),
/**
* @type {Avoid}
*/
Avoid: undefined,
/**
* @description 当前仿真结果的顶层模块的名字
* @type {string}
*/
topModuleName: '',
/**
* @description 当前选择的实体,可以是 wire也可以是 cell
*/
currentSelectEntity: undefined,
/**
* @description 右侧 treeview 选择的需要展示数据的实体
* @type {Record<string, string>}
*/
currentSelectEntityInfo: {}
});
function loadSetting() {
const settingString = localStorage.getItem('setting')
try {
const setting = JSON.parse(settingString);
return setting;
} catch (error) {
return undefined;
}
}
export const storedSetting = loadSetting();
if (storedSetting) {
for (const key of Reflect.ownKeys(storedSetting)) {
const value = storedSetting[key];
if (value !== undefined) {
globalSetting[key] = value;
}
}
}