UNPKG

mudb

Version:

Real-time database for multiplayer games

23 lines 778 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class MuRPCFetchClientTransport { constructor(spec) { this._url = spec.url; } async send(schemas, arg) { const body = JSON.stringify(schemas.argSchema.toJSON(arg)); const response = await (await fetch(this._url + '/' + schemas.protocol.name, { method: 'POST', mode: 'same-origin', cache: 'no-cache', headers: { 'Content-Type': 'application/json', }, redirect: 'follow', body, })).json(); return schemas.responseSchema.fromJSON(response); } } exports.MuRPCFetchClientTransport = MuRPCFetchClientTransport; //# sourceMappingURL=client-fetch.js.map