greybel-interpreter 4.0.3 → 4.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { OperationContext } from '../context';
1
+ import type { VM } from '../vm';
2
2
  export interface KeyEvent {
3
3
  keyCode?: number;
4
4
  charCode?: number;
@@ -9,16 +9,16 @@ export interface PrintOptions {
9
9
  replace: boolean;
10
10
  }
11
11
  export declare abstract class OutputHandler {
12
- abstract print(ctx: OperationContext, message: string, options?: Partial<PrintOptions>): void;
13
- abstract progress(ctx: OperationContext, timeout: number): PromiseLike<void>;
14
- abstract waitForInput(ctx: OperationContext, isPassword: boolean, message?: string): PromiseLike<string>;
15
- abstract waitForKeyPress(ctx: OperationContext, message?: string): PromiseLike<KeyEvent>;
16
- abstract clear(ctx: OperationContext): void;
12
+ abstract print(vm: VM, message: string, options?: Partial<PrintOptions>): void;
13
+ abstract progress(vm: VM, timeout: number): PromiseLike<void>;
14
+ abstract waitForInput(vm: VM, isPassword: boolean, message?: string): PromiseLike<string>;
15
+ abstract waitForKeyPress(vm: VM, message?: string): PromiseLike<KeyEvent>;
16
+ abstract clear(vm: VM): void;
17
17
  }
18
18
  export declare class DefaultOutputHandler extends OutputHandler {
19
- print(_ctx: OperationContext, message: string, { appendNewLine }?: Partial<PrintOptions>): void;
20
- progress(_ctx: OperationContext, timeout: number): PromiseLike<void>;
21
- waitForInput(_ctx: OperationContext, _isPassword: boolean, _message?: string): PromiseLike<string>;
22
- waitForKeyPress(_ctx: OperationContext, _message?: string): PromiseLike<KeyEvent>;
23
- clear(_ctx: OperationContext): void;
19
+ print(_vm: VM, message: string, { appendNewLine }?: Partial<PrintOptions>): void;
20
+ progress(_vm: VM, timeout: number): PromiseLike<void>;
21
+ waitForInput(_vm: VM, _isPassword: boolean, _message?: string): PromiseLike<string>;
22
+ waitForKeyPress(_vm: VM, _message?: string): PromiseLike<KeyEvent>;
23
+ clear(_vm: VM): void;
24
24
  }
@@ -5,7 +5,7 @@ class OutputHandler {
5
5
  }
6
6
  exports.OutputHandler = OutputHandler;
7
7
  class DefaultOutputHandler extends OutputHandler {
8
- print(_ctx, message, { appendNewLine = true } = {}) {
8
+ print(_vm, message, { appendNewLine = true } = {}) {
9
9
  if (appendNewLine) {
10
10
  process.stdout.write(message + '\n');
11
11
  }
@@ -13,21 +13,21 @@ class DefaultOutputHandler extends OutputHandler {
13
13
  process.stdout.write(message);
14
14
  }
15
15
  }
16
- progress(_ctx, timeout) {
16
+ progress(_vm, timeout) {
17
17
  return new Promise((resolve, _reject) => {
18
18
  setTimeout(resolve, timeout);
19
19
  });
20
20
  }
21
- waitForInput(_ctx, _isPassword, _message) {
21
+ waitForInput(_vm, _isPassword, _message) {
22
22
  return Promise.resolve('test');
23
23
  }
24
- waitForKeyPress(_ctx, _message) {
24
+ waitForKeyPress(_vm, _message) {
25
25
  return Promise.resolve({
26
26
  keyCode: 13,
27
27
  code: 'Enter'
28
28
  });
29
29
  }
30
- clear(_ctx) {
30
+ clear(_vm) {
31
31
  console.clear();
32
32
  }
33
33
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "greybel-interpreter",
3
- "version": "4.0.3",
3
+ "version": "4.0.4",
4
4
  "description": "Interpreter",
5
5
  "main": "dist/index",
6
6
  "typings": "dist/index",