orep-js/sunpy/node/nodes/propertynode.js

22 lines
591 B
JavaScript
Raw Normal View History

2020-04-21 00:03:26 +02:00
import { SwapNode } from "./swapnode.js";
import { PropertyReader } from "../propertyreader.js";
export class PropertyNode extends SwapNode {
constructor(node, swapNode, propertyReader) {
super(node, swapNode);
if (!(propertyReader instanceof PropertyReader))
2020-04-21 15:55:56 +02:00
throw TypeError("propertyReader must be an instance of `PropertyReader`");
2020-04-21 00:03:26 +02:00
this.propertyReader = propertyReader;
super.replaceNodes();
}
/**
* @override
*/
linker(node, swapNode) {
this.properties = this.propertyReader.read(node.innerText);
}
}