All Projects → amio → Console.js

amio / Console.js

Licence: mit
A game console (video game cli) for browsers.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Console.js

D2x Cios
A custom IOS for the Wii and Wii-U console, i.e. an IOS modified to add some new features not available in the official IOS.
Stars: ✭ 91 (-14.95%)
Mutual labels:  console
Dte
A small, configurable console text editor (moved to https://gitlab.com/craigbarnes/dte)
Stars: ✭ 98 (-8.41%)
Mutual labels:  console
Webpack Format Messages
Beautiful formatting for Webpack messages; ported from Create React App!
Stars: ✭ 103 (-3.74%)
Mutual labels:  console
Eazydict
简单易用的命令行词典 📕 📙 📗 📘 📓
Stars: ✭ 92 (-14.02%)
Mutual labels:  console
Web Console
Simple web-based shell, remote shell in your browser
Stars: ✭ 1,344 (+1156.07%)
Mutual labels:  console
Astray
Astray is a lua based maze, room and dungeon generation library for dungeon crawlers and rougelike video games
Stars: ✭ 99 (-7.48%)
Mutual labels:  video-game
Multiplex
View output of multiple processes, in parallel, in the console, with an interactive TUI
Stars: ✭ 91 (-14.95%)
Mutual labels:  console
Joomlatools Console
Command line interface (CLI) for Joomla.
Stars: ✭ 106 (-0.93%)
Mutual labels:  console
Tooling
Advancing Node.js as a framework for writing great tools
Stars: ✭ 98 (-8.41%)
Mutual labels:  console
Parallel Process
🏃 Run multiple processes simultaneously
Stars: ✭ 102 (-4.67%)
Mutual labels:  console
Cloudcmd
✨☁️📁✨ Cloud Commander file manager for the web with console and editor.
Stars: ✭ 1,332 (+1144.86%)
Mutual labels:  console
Chromephp
class for logging PHP variables to Google Chrome console
Stars: ✭ 1,339 (+1151.4%)
Mutual labels:  console
Jvm Mon
Console-based JVM monitoring tool
Stars: ✭ 1,365 (+1175.7%)
Mutual labels:  console
Zabuyaki
Zabuyaki, old-school side-scrolling beat 'em up
Stars: ✭ 91 (-14.95%)
Mutual labels:  video-game
Console Log Viewer
Displays logs and Javascript errors in an overlay on top of your site. Useful for mobile webdevelopment. Enabled in 5 seconds
Stars: ✭ 103 (-3.74%)
Mutual labels:  console
Openxcom
Open-source clone of the original X-Com 👽
Stars: ✭ 1,302 (+1116.82%)
Mutual labels:  video-game
Ranger
Authors: see AUTHORS file License: GNU General Public License Version 3 Website: https://ranger.github.io/ Download: https://ranger.github.io/ranger-stable.tar.gz Bug reports: https://github.com/ranger/ranger/issues git clone https://github.com/ranger/ranger.git
Stars: ✭ 10,697 (+9897.2%)
Mutual labels:  console
Simple Console
Add an elegant command-line interface to any page
Stars: ✭ 107 (+0%)
Mutual labels:  console
Aura.cli
Command-Line Interface tools
Stars: ✭ 103 (-3.74%)
Mutual labels:  console
Esoui
ESOUI is the Lua source code of the ZenimaxOnline's MMORPG "The Elder Scrolls Online"
Stars: ✭ 100 (-6.54%)
Mutual labels:  video-game

Console.js npm-version

Console.js is a tiny lib for creating Console (video game cli) popups in browser.

NEW: v2.0 is out 😺

Console.js Screenshot

Check the Live Demo, or Basic Usage / Advance Usage / API.

Basic Usage

  1. To install console.js, either:
  • Use npm: npm install console.js
  • Include console.js in html:
    <script src="https://unpkg.com/[email protected]"></script>
  1. Create a Console:
const cnsl = new Console({ hotkey: 192 })

cnsl.register('addbots', function (num) {
    // Add some bots, then tell player:
    return num + ' bots added.'
})

Advance Usage

Options

var cnsl = new Console({
    hotkey: 27, // <kbd>ESC</kbd>
    welcome: 'Hello User.',
    caseSensitive: true,
    autoComplete: true,
    defaultHandler: function () {},
    onShow: function () {},
    onHide: function () {}
}, {
  'cmd1': function (args) {/*...*/},
  'cmd2': function (args) {/*...*/}
});
  • hotkey : {Number|Boolean} The keyCode of hotkey. 192(the ~) by default.
  • welcome: {String} The welcome message. '' by default.
  • caseSensitive: {Boolean} If you want to. false by default.
  • autoComplete: {Boolean|Function} Enable tab for auto completion.
  • defaultHandler: {Function} The fallback handler for all commands. noop by default.
  • onShow : {Function} On show callback. noop by default.
  • onHide : {Function} On hide callback. noop by default.

Register command with extra config

.register(commandName, commandHandler, commandConfig)

var cnsl = new Console()

cnsl.register('say', function () {
  return player.name + ': "' + Array.prototype.join.call(arguments, ' ') + '"'
}, {
  usage: 'SAY <message string>: Broadcast a message to other players in the game.'
})

cnsl.register('help', function () {
  return Object.keys(cnsl.handlers).map(function (name) {
    return ' - ' + cnsl.handlers[name].cfg.usage
  }).join('\n')
}, {
  usage: 'HELP: Show help messages.'
})

Custome autoComplete function

var cnsl = new Console({
  hotkey: 27,
  autoComplete: customeAutoComplete
})

function customeAutoComplete (inputString) {
  const availableCommands = Object.keys(cnsl.handlers)
  cnsl.log(availableCommands.join(' '))

  return inputString
}

API

Create a Console

  • new Console() Create a console instance (with default options)
  • new Console(options) Create a console with options. (see Basic Usage)

Instance Methods

Note: Console instances on https://amio.github.io/console.js/ were exposed on window. You can fiddle with them(window.cnsl and window.smtc) in devtools.

.register(command, handler[, config])

  • .register(command, handler) Register a handler to command
  • .register(command, handler, config) Register a handler to cmd with a config object
  • .register(handler) Register a defaultHandler

.log(msg[, cmd])

  • .log(msg) Write a message to console
  • .log(msg, cmd) Write a message with an instruction to console

.clear()

  • .clear() Clear history

.toggle([switch])

  • .toggle() Toggle the console
  • .toggle("on") Open it
  • .toggle("off") Close it

.destroy()

  • .destroy() Suicide.

License

MIT © Amio

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].