jsketcher/modules/scene/objectData.js
2018-06-11 20:13:42 -07:00

21 lines
No EOL
393 B
JavaScript

export function setAttribute(obj, key, value) {
getData(obj)[key] = value;
}
export function getAttribute(obj, key) {
return getData(obj)[key];
}
export function unsetAttribute(obj, key) {
delete getData(obj)[key];
}
export function getData(obj) {
let data = obj.__TCAD_CUSTOM_DATA;
if (data === undefined) {
data = {};
obj.__TCAD_CUSTOM_DATA = data;
}
return data;
}