1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-24 15:19:26 -05:00

Rename sendMsgFromObject to sendMsg

This commit is contained in:
Ryan Dahl 2018-05-23 11:31:53 -04:00
parent 602ee0d5a1
commit be4883722f
3 changed files with 6 additions and 9 deletions

View file

@ -26,10 +26,7 @@ export function pub(channel: string, payload: Uint8Array): null | ArrayBuffer {
// Internal version of "pub". // Internal version of "pub".
// TODO add internal version of "sub" // TODO add internal version of "sub"
// TODO rename to pubInternal() // TODO rename to pubInternal()
export function sendMsgFromObject( export function sendMsg(channel: string, obj: pb.IMsg): null | pb.Msg {
channel: string,
obj: pb.IMsg
): null | pb.Msg {
const msg = pb.Msg.fromObject(obj); const msg = pb.Msg.fromObject(obj);
const ui8 = pb.Msg.encode(msg).finish(); const ui8 = pb.Msg.encode(msg).finish();
const resBuf = pub(channel, ui8); const resBuf = pub(channel, ui8);

8
os.ts
View file

@ -1,15 +1,15 @@
import { ModuleInfo } from "./types"; import { ModuleInfo } from "./types";
import { sendMsgFromObject } from "./dispatch"; import { sendMsg } from "./dispatch";
export function exit(code = 0): void { export function exit(code = 0): void {
sendMsgFromObject("os", { exit: { code } }); sendMsg("os", { exit: { code } });
} }
export function sourceCodeFetch( export function sourceCodeFetch(
moduleSpecifier: string, moduleSpecifier: string,
containingFile: string containingFile: string
): ModuleInfo { ): ModuleInfo {
const res = sendMsgFromObject("os", { const res = sendMsg("os", {
sourceCodeFetch: { moduleSpecifier, containingFile } sourceCodeFetch: { moduleSpecifier, containingFile }
}); });
return res.sourceCodeFetchRes; return res.sourceCodeFetchRes;
@ -20,7 +20,7 @@ export function sourceCodeCache(
sourceCode: string, sourceCode: string,
outputCode: string outputCode: string
): void { ): void {
sendMsgFromObject("os", { sendMsg("os", {
sourceCodeCache: { filename, sourceCode, outputCode } sourceCodeCache: { filename, sourceCode, outputCode }
}); });
} }

View file

@ -37,7 +37,7 @@ export function setTimeout(cb: TimerCallback, duration: number): number {
cb cb
}; };
timers.set(timer.id, timer); timers.set(timer.id, timer);
dispatch.sendMsgFromObject("timers", { dispatch.sendMsg("timers", {
timerStart: { timerStart: {
id: timer.id, id: timer.id,
interval: false, interval: false,