123456789101112131415161718 |
- class SayYour extends Say {
- private node : Text = document.createTextNode("a ");
- private uppercase = true;
- public constructor (autoUppercase = true) {
- super();
- this.uppercase = autoUppercase;
- }
- public async getPureElements (say : Say) : Promise<Array<Element | Text>> {
- this.node.nodeValue = "your";
- if (this.uppercase && say.currentParagraph.length == 0) {
- this.node.nodeValue = this.node.nodeValue.charAt(0).toUpperCase()
- + this.node.nodeValue.substr(1, this.node.nodeValue.length - 1);
- }
- return [this.node];
- }
- }
|