svghmi/gen_index_xhtml.xslt
branchsvghmi
changeset 3195 cdd2a032b424
parent 3191 26b7c4aa7b38
child 3199 1582753e409b
equal deleted inserted replaced
3191:26b7c4aa7b38 3195:cdd2a032b424
  4605 </xsl:text>
  4605 </xsl:text>
  4606     <xsl:text>    do_http_request(...opt) {
  4606     <xsl:text>    do_http_request(...opt) {
  4607 </xsl:text>
  4607 </xsl:text>
  4608     <xsl:text>        this.abort_controller = new AbortController();
  4608     <xsl:text>        this.abort_controller = new AbortController();
  4609 </xsl:text>
  4609 </xsl:text>
  4610     <xsl:text>        const query = {
  4610     <xsl:text>        return Promise.resolve().then(() =&gt; {
  4611 </xsl:text>
  4611 </xsl:text>
  4612     <xsl:text>            args: this.args,
  4612     <xsl:text>
  4613 </xsl:text>
  4613 </xsl:text>
  4614     <xsl:text>            range: this.cache[1],
  4614     <xsl:text>            const query = {
  4615 </xsl:text>
  4615 </xsl:text>
  4616     <xsl:text>            position: this.cache[2],
  4616     <xsl:text>                args: this.args,
  4617 </xsl:text>
  4617 </xsl:text>
  4618     <xsl:text>            visible: this.visible,
  4618     <xsl:text>                range: this.cache[1],
  4619 </xsl:text>
  4619 </xsl:text>
  4620     <xsl:text>            extra: this.cache.slice(4),
  4620     <xsl:text>                position: this.cache[2],
  4621 </xsl:text>
  4621 </xsl:text>
  4622     <xsl:text>            options: opt
  4622     <xsl:text>                visible: this.visible,
  4623 </xsl:text>
  4623 </xsl:text>
  4624     <xsl:text>        };
  4624     <xsl:text>                extra: this.cache.slice(4),
  4625 </xsl:text>
  4625 </xsl:text>
  4626     <xsl:text>
  4626     <xsl:text>                options: opt
  4627 </xsl:text>
  4627 </xsl:text>
  4628     <xsl:text>        const options = {
  4628     <xsl:text>            };
  4629 </xsl:text>
  4629 </xsl:text>
  4630     <xsl:text>             method: 'POST',
  4630     <xsl:text>
  4631 </xsl:text>
  4631 </xsl:text>
  4632     <xsl:text>             body: JSON.stringify(query),
  4632     <xsl:text>            const options = {
  4633 </xsl:text>
  4633 </xsl:text>
  4634     <xsl:text>             headers: {'Content-Type': 'application/json'},
  4634     <xsl:text>                 method: 'POST',
  4635 </xsl:text>
  4635 </xsl:text>
  4636     <xsl:text>             signal: this.abort_controller.signal
  4636     <xsl:text>                 body: JSON.stringify(query),
  4637 </xsl:text>
  4637 </xsl:text>
  4638     <xsl:text>        };
  4638     <xsl:text>                 headers: {'Content-Type': 'application/json'},
  4639 </xsl:text>
  4639 </xsl:text>
  4640     <xsl:text>
  4640     <xsl:text>                 signal: this.abort_controller.signal
  4641 </xsl:text>
  4641 </xsl:text>
  4642     <xsl:text>        return fetch(this.args[0], options)
  4642     <xsl:text>            };
  4643 </xsl:text>
  4643 </xsl:text>
  4644     <xsl:text>                .then(this.handle_http_response_bound)
  4644     <xsl:text>
  4645 </xsl:text>
  4645 </xsl:text>
  4646     <xsl:text>                .then(this.spread_json_data_bound)
  4646     <xsl:text>            return fetch(this.args[0], options)
  4647 </xsl:text>
  4647 </xsl:text>
  4648     <xsl:text>                .catch(this.fetch_error_bound);
  4648     <xsl:text>                    .then(this.handle_http_response_bound)
  4649 </xsl:text>
  4649 </xsl:text>
  4650     <xsl:text>
  4650     <xsl:text>                    .then(this.spread_json_data_bound)
  4651 </xsl:text>
  4651 </xsl:text>
  4652     <xsl:text>    }
  4652     <xsl:text>                    .catch(this.fetch_error_bound);
       
  4653 </xsl:text>
       
  4654     <xsl:text>        });
       
  4655 </xsl:text>
       
  4656     <xsl:text>    }
       
  4657 </xsl:text>
       
  4658     <xsl:text>
  4653 </xsl:text>
  4659 </xsl:text>
  4654     <xsl:text>    unsub(){
  4660     <xsl:text>    unsub(){
  4655 </xsl:text>
  4661 </xsl:text>
  4656     <xsl:text>        this.abort_controller.abort();
  4662     <xsl:text>        this.abort_controller.abort();
  4657 </xsl:text>
  4663 </xsl:text>