@animech-public/playcanvas
Version:
PlayCanvas WebGL game engine
2 lines (1 loc) • 607 B
JavaScript
import{http as e}from"../../platform/net/http.js";import{Template as t}from"../template.js";import{ResourceHandler as r}from"./handler.js";class o extends r{constructor(e){super(e,"template"),this.decoder=null}load(t,r){"string"==typeof t&&(t={load:t,original:t});const o={retry:this.maxRetries>0,maxRetries:this.maxRetries};e.get(t.load,o,((e,o)=>{e?r(`Error requesting template: ${t.original}`):r(e,o)}))}open(e,r){return new t(this._app,r)}openBinary(e){return null!=this.decoder||(this.decoder=new TextDecoder("utf-8")),new t(this._app,JSON.parse(this.decoder.decode(e)))}}export{o as TemplateHandler};