You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
613 B
48 lines
613 B
2 years ago
|
import { InputNode } from '../core/InputNode.js';
|
||
|
|
||
|
class PropertyNode extends InputNode {
|
||
|
|
||
|
constructor( object, property, type ) {
|
||
|
|
||
|
super( type );
|
||
|
|
||
|
this.object = object;
|
||
|
this.property = property;
|
||
|
|
||
|
}
|
||
|
|
||
|
get value() {
|
||
|
|
||
|
return this.object[ this.property ];
|
||
|
|
||
|
}
|
||
|
|
||
|
set value( val ) {
|
||
|
|
||
|
this.object[ this.property ] = val;
|
||
|
|
||
|
}
|
||
|
|
||
|
toJSON( meta ) {
|
||
|
|
||
|
let data = this.getJSONNode( meta );
|
||
|
|
||
|
if ( ! data ) {
|
||
|
|
||
|
data = this.createJSONNode( meta );
|
||
|
|
||
|
data.value = this.value;
|
||
|
data.property = this.property;
|
||
|
|
||
|
}
|
||
|
|
||
|
return data;
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
PropertyNode.prototype.nodeType = 'Property';
|
||
|
|
||
|
export { PropertyNode };
|