UNPKG

@animech-public/playcanvas

Version:
2 lines (1 loc) 494 B
import{http as e}from"../../platform/net/http.js";import{ResourceHandler as r}from"./handler.js";class t extends r{constructor(e){super(e,"text"),this.decoder=null}load(r,t){"string"==typeof r&&(r={load:r,original:r}),e.get(r.load,{retry:this.maxRetries>0,maxRetries:this.maxRetries},((e,o)=>{e?t(`Error loading text resource: ${r.original} [${e}]`):t(null,o)}))}openBinary(e){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),this.decoder.decode(e)}}export{t as TextHandler};