From c44c2f4f701741a04e3c437e0c21733c7743a196 Mon Sep 17 00:00:00 2001 From: He4eT Date: Wed, 24 Feb 2021 18:42:30 +0500 Subject: [PATCH] Update README.md --- README.md | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 2942cb0..815c9f7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,11 @@ Can be used in Node.js or in a web browser. ## Usage -This repository includes examples of [stdio interface implementation](https://github.com/He4eT/cheap-glkote/blob/master/src/stdio.js) and [integration with Emglken](https://github.com/He4eT/cheap-glkote/blob/master/tests/player.stdio.js). +This repository includes examples of [stdio interface implementation](https://github.com/He4eT/cheap-glkote/blob/master/src/stdio.js) and [integration with Emglken](https://github.com/He4eT/cheap-glkote/blob/master/tests/player.stdio.js).
+You can try this version with `npx`: +``` +npx cheap-glkote path/to/storyfile +``` ### Initialization ```js @@ -15,8 +19,9 @@ const { glkInterface, sendFn } = CheapGlkOte(handlers [, loggers]) ### Input ```js -sendFn('open door') +sendFn('open door', windowObject) ``` +You can received `windowObject` in `onUpdateWindows` handler.
You should respect input type setted by `onUpdateInputs`. ### Output and lifecycle @@ -27,14 +32,9 @@ const handlers = { * It's time to prepare the user interface. */ }, - onExit: () => { + onUpdateWindows: windows => { /** - * Game is over. - */ - }, - onUpdateContent: messages => { - /** - * Process the game output here. + * Game wants to change the number of windows. */ }, onUpdateInputs: type => { @@ -43,6 +43,11 @@ const handlers = { * Supported types: 'char', 'line'. */ }, + onUpdateContent: messages => { + /** + * Process the game output here. + */ + }, onDisable: () => { /** * Game wants to disable user interface. @@ -66,6 +71,11 @@ const handlers = { /** * Game wants to write the contents in the file. */ + }, + onExit: () => { + /** + * Game is over. + */ } } ```