mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-22 03:07:04 +02:00
api strings
This commit is contained in:
1 parent
99317c2075
commit
5f24887535
23 files changed
+132
-118
No files matched your search
@@ -0,0 +1,5 @@
|
||||
export async function fetchJSON<Type>(url: string) {
|
||||
const response = await fetch(url);
|
||||
const json = await response.json();
|
||||
return json as Type;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { MessageFns } from "@blitzkit/protos/src/blitzkit";
|
||||
|
||||
export async function fetchPB<Type>(url: string, message: MessageFns<Type>) {
|
||||
const response = await fetch(url);
|
||||
const buffer = await response.arrayBuffer();
|
||||
const array = new Uint8Array(buffer);
|
||||
return message.decode(array);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './fetchPB';
|
||||
export * from './pbMap';
|
||||
Reference in new issue
Block a user