OgarProject / Ogar

An open source Agar.io server implementation, written with Node.js.
Other
717 stars 825 forks source link

Perfected Async Console. #678

Closed Andrews54757 closed 7 years ago

Andrews54757 commented 7 years ago

So after @Luka967 mentioned the windows bug, I fixed it. But then, as I fixed it, I thought "Why don't I make it better?". So, I streamlined the entire thing into a module. And it has all you need.

CHANGES

  1. Works for any OS
  2. Left and right keys now allow you to edit your typed command
  3. The module now has an easy way to use it
  4. Fixed every bug I mentioned in #670

MODULE SPECS:

Usage:

var AsyncConsole = require('asyncconsole');
var input = new AsyncConsole("> ",function(str) { // arguments: AsyncConsole(prompttext,callback,test?)
// do something with str.
})
// other things:

input.pause() // pause it
input.resume() // resume
input.up() // stimulate up key
input.down() // stimulate down key
input.left() // stimulate left key
input.right() // stimulate right key
input.enter() // stimulate enter key
input.back() // stimulate back key
input.key(character) // stimulate inserting a character

NPM: https://www.npmjs.com/package/asyncconsole

Andrews54757 commented 7 years ago

@vram4

GhostShot3 commented 7 years ago

Nice