-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename sendMsg to pubInternal (#136)
- Loading branch information
1 parent
8094c74
commit 78124cd
Showing
4 changed files
with
14 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// Copyright 2018 Ryan Dahl <[email protected]> | ||
// All rights reserved. MIT License. | ||
import { ModuleInfo } from "./types"; | ||
import { sendMsg } from "./dispatch"; | ||
import { pubInternal } from "./dispatch"; | ||
import { main as pb } from "./msg.pb"; | ||
import { assert } from "./util"; | ||
|
||
export function exit(exitCode = 0): void { | ||
sendMsg("os", { | ||
pubInternal("os", { | ||
command: pb.Msg.Command.EXIT, | ||
exitCode | ||
}); | ||
|
@@ -16,7 +16,7 @@ export function codeFetch( | |
moduleSpecifier: string, | ||
containingFile: string | ||
): ModuleInfo { | ||
const res = sendMsg("os", { | ||
const res = pubInternal("os", { | ||
command: pb.Msg.Command.CODE_FETCH, | ||
codeFetchModuleSpecifier: moduleSpecifier, | ||
codeFetchContainingFile: containingFile | ||
|
@@ -35,7 +35,7 @@ export function codeCache( | |
sourceCode: string, | ||
outputCode: string | ||
): void { | ||
sendMsg("os", { | ||
pubInternal("os", { | ||
command: pb.Msg.Command.CODE_CACHE, | ||
codeCacheFilename: filename, | ||
codeCacheSourceCode: sourceCode, | ||
|
@@ -44,7 +44,7 @@ export function codeCache( | |
} | ||
|
||
export function readFileSync(filename: string): Uint8Array { | ||
const res = sendMsg("os", { | ||
const res = pubInternal("os", { | ||
command: pb.Msg.Command.READ_FILE_SYNC, | ||
readFileSyncFilename: filename | ||
}); | ||
|
@@ -56,7 +56,7 @@ export function writeFileSync( | |
data: Uint8Array, | ||
perm: number | ||
): void { | ||
sendMsg("os", { | ||
pubInternal("os", { | ||
command: pb.Msg.Command.WRITE_FILE_SYNC, | ||
writeFileSyncFilename: filename, | ||
writeFileSyncData: data, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
// Copyright 2018 Ryan Dahl <[email protected]> | ||
// All rights reserved. MIT License. | ||
import { main as pb } from "./msg.pb"; | ||
import * as dispatch from "./dispatch"; | ||
import { pubInternal, sub } from "./dispatch"; | ||
import { assert } from "./util"; | ||
|
||
let nextTimerId = 1; | ||
|
@@ -21,7 +21,7 @@ interface Timer { | |
const timers = new Map<number, Timer>(); | ||
|
||
export function initTimers() { | ||
dispatch.sub("timers", onMessage); | ||
sub("timers", onMessage); | ||
} | ||
|
||
function onMessage(payload: Uint8Array) { | ||
|
@@ -54,7 +54,7 @@ function setTimer( | |
cb | ||
}; | ||
timers.set(timer.id, timer); | ||
dispatch.sendMsg("timers", { | ||
pubInternal("timers", { | ||
command: pb.Msg.Command.TIMER_START, | ||
timerStartId: timer.id, | ||
timerStartInterval: timer.interval, | ||
|
@@ -82,7 +82,7 @@ export function setInterval( | |
} | ||
|
||
export function clearTimer(id: number) { | ||
dispatch.sendMsg("timers", { | ||
pubInternal("timers", { | ||
command: pb.Msg.Command.TIMER_CLEAR, | ||
timerClearId: id | ||
}); | ||
|