summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2018-05-23 11:31:53 -0400
committerRyan Dahl <ry@tinyclouds.org>2018-05-23 11:31:53 -0400
commitbe4883722f00ac71d4586f2e80557fd2ba055d24 (patch)
treef0779d25dca30811a5344dc2ee4fcb6487f2639c
parent602ee0d5a1b092faf8f29cac0727a28640aac0b0 (diff)
Rename sendMsgFromObject to sendMsg
-rw-r--r--dispatch.ts5
-rw-r--r--os.ts8
-rw-r--r--timers.ts2
3 files changed, 6 insertions, 9 deletions
diff --git a/dispatch.ts b/dispatch.ts
index 859792b74..c2a7a6ef7 100644
--- a/dispatch.ts
+++ b/dispatch.ts
@@ -26,10 +26,7 @@ export function pub(channel: string, payload: Uint8Array): null | ArrayBuffer {
// Internal version of "pub".
// TODO add internal version of "sub"
// TODO rename to pubInternal()
-export function sendMsgFromObject(
- channel: string,
- obj: pb.IMsg
-): null | pb.Msg {
+export function sendMsg(channel: string, obj: pb.IMsg): null | pb.Msg {
const msg = pb.Msg.fromObject(obj);
const ui8 = pb.Msg.encode(msg).finish();
const resBuf = pub(channel, ui8);
diff --git a/os.ts b/os.ts
index b2f9e93ba..409c1186f 100644
--- a/os.ts
+++ b/os.ts
@@ -1,15 +1,15 @@
import { ModuleInfo } from "./types";
-import { sendMsgFromObject } from "./dispatch";
+import { sendMsg } from "./dispatch";
export function exit(code = 0): void {
- sendMsgFromObject("os", { exit: { code } });
+ sendMsg("os", { exit: { code } });
}
export function sourceCodeFetch(
moduleSpecifier: string,
containingFile: string
): ModuleInfo {
- const res = sendMsgFromObject("os", {
+ const res = sendMsg("os", {
sourceCodeFetch: { moduleSpecifier, containingFile }
});
return res.sourceCodeFetchRes;
@@ -20,7 +20,7 @@ export function sourceCodeCache(
sourceCode: string,
outputCode: string
): void {
- sendMsgFromObject("os", {
+ sendMsg("os", {
sourceCodeCache: { filename, sourceCode, outputCode }
});
}
diff --git a/timers.ts b/timers.ts
index 117fde2a8..f5f039f1c 100644
--- a/timers.ts
+++ b/timers.ts
@@ -37,7 +37,7 @@ export function setTimeout(cb: TimerCallback, duration: number): number {
cb
};
timers.set(timer.id, timer);
- dispatch.sendMsgFromObject("timers", {
+ dispatch.sendMsg("timers", {
timerStart: {
id: timer.id,
interval: false,