-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate external and internal defs (#70)
Co-authored-by: foo <[email protected]>
- Loading branch information
1 parent
4d6e3ac
commit 79c3eab
Showing
5 changed files
with
75 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,25 @@ | ||
import { IObservableDisposable } from '@lumino/disposable'; | ||
|
||
import { | ||
IEnableBufferedStdinCallback, | ||
IOutputCallback, | ||
IStdinCallback, | ||
ITerminateCallback | ||
} from './callback'; | ||
import { IOutputCallback } from './callback'; | ||
|
||
import { ProxyMarked, Remote } from 'comlink'; | ||
|
||
interface IOptionsCommon { | ||
color?: boolean; | ||
mountpoint?: string; | ||
wasmBaseUrl: string; | ||
driveFsBaseUrl?: string; | ||
// Initial directories and files to create, for testing purposes. | ||
initialDirectories?: string[]; | ||
initialFiles?: IShell.IFiles; | ||
} | ||
|
||
export interface IShellCommon { | ||
export interface IShell extends IObservableDisposable { | ||
input(char: string): Promise<void>; | ||
setSize(rows: number, columns: number): Promise<void>; | ||
start(): Promise<void>; | ||
} | ||
|
||
export interface IShell extends IObservableDisposable, IShellCommon {} | ||
|
||
export namespace IShell { | ||
export interface IOptions extends IOptionsCommon { | ||
export interface IOptions { | ||
color?: boolean; | ||
mountpoint?: string; | ||
wasmBaseUrl: string; | ||
driveFsBaseUrl?: string; | ||
// Initial directories and files to create, for testing purposes. | ||
initialDirectories?: string[]; | ||
initialFiles?: IShell.IFiles; | ||
|
||
outputCallback: IOutputCallback; | ||
} | ||
|
||
export type IFiles = { [key: string]: string }; | ||
} | ||
|
||
export interface IShellWorker extends IShellCommon { | ||
// Handle any lazy initialization activities. | ||
// Callback proxies need to be separate arguments, they cannot be in IOptions. | ||
initialize( | ||
options: IShellWorker.IOptions, | ||
outputCallback: IShellWorker.IProxyOutputCallback, | ||
enableBufferedStdinCallback: IShellWorker.IProxyEnableBufferedStdinCallback, | ||
terminateCallback: IShellWorker.IProxyTerminateCallback | ||
): void; | ||
} | ||
|
||
export namespace IShellWorker { | ||
export interface IProxyOutputCallback extends IOutputCallback, ProxyMarked {} | ||
export interface IProxyEnableBufferedStdinCallback | ||
extends IEnableBufferedStdinCallback, | ||
ProxyMarked {} | ||
export interface IProxyTerminateCallback extends ITerminateCallback, ProxyMarked {} | ||
|
||
export interface IOptions extends IOptionsCommon { | ||
sharedArrayBuffer: SharedArrayBuffer; | ||
} | ||
} | ||
|
||
export type IRemoteShell = Remote<IShellWorker>; | ||
|
||
export namespace IShellImpl { | ||
export interface IOptions extends IOptionsCommon { | ||
outputCallback: IOutputCallback; | ||
enableBufferedStdinCallback: IEnableBufferedStdinCallback; | ||
stdinCallback: IStdinCallback; | ||
terminateCallback: IShellWorker.IProxyTerminateCallback; | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { | ||
IEnableBufferedStdinCallback, | ||
IOutputCallback, | ||
IStdinCallback, | ||
ITerminateCallback | ||
} from './callback'; | ||
|
||
import { IShell } from './defs'; | ||
|
||
import { ProxyMarked, Remote } from 'comlink'; | ||
|
||
interface IOptionsCommon { | ||
color?: boolean; | ||
mountpoint?: string; | ||
wasmBaseUrl: string; | ||
driveFsBaseUrl?: string; | ||
// Initial directories and files to create, for testing purposes. | ||
initialDirectories?: string[]; | ||
initialFiles?: IShell.IFiles; | ||
} | ||
|
||
interface IShellCommon { | ||
input(char: string): Promise<void>; | ||
setSize(rows: number, columns: number): Promise<void>; | ||
start(): Promise<void>; | ||
} | ||
|
||
export interface IShellWorker extends IShellCommon { | ||
// Handle any lazy initialization activities. | ||
// Callback proxies need to be separate arguments, they cannot be in IOptions. | ||
initialize( | ||
options: IShellWorker.IOptions, | ||
outputCallback: IShellWorker.IProxyOutputCallback, | ||
enableBufferedStdinCallback: IShellWorker.IProxyEnableBufferedStdinCallback, | ||
terminateCallback: IShellWorker.IProxyTerminateCallback | ||
): void; | ||
} | ||
|
||
export namespace IShellWorker { | ||
export interface IProxyOutputCallback extends IOutputCallback, ProxyMarked {} | ||
export interface IProxyEnableBufferedStdinCallback | ||
extends IEnableBufferedStdinCallback, | ||
ProxyMarked {} | ||
export interface IProxyTerminateCallback extends ITerminateCallback, ProxyMarked {} | ||
|
||
export interface IOptions extends IOptionsCommon { | ||
sharedArrayBuffer: SharedArrayBuffer; | ||
} | ||
} | ||
|
||
export type IRemoteShell = Remote<IShellWorker>; | ||
|
||
export namespace IShellImpl { | ||
export interface IOptions extends IOptionsCommon { | ||
outputCallback: IOutputCallback; | ||
enableBufferedStdinCallback: IEnableBufferedStdinCallback; | ||
stdinCallback: IStdinCallback; | ||
terminateCallback: IShellWorker.IProxyTerminateCallback; | ||
} | ||
} |
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