Socket
Book a DemoInstallSign in
Socket

browser-console-listener

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-console-listener

Listen for things typed in the browser console

1.0.1
latest
Source
npmnpm
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

browser-console-listener

Listen for things typed in the browser console.

Usage

console.log('Do you like ice cream? (yes or no)');

var bcl = require('browser-console-listener');
var listener = bcl(window);

listener.listen(['yes', 'no'], function(selection) {
  console.log('you said ' + selection + '!');
});

API

var bcl = require('browser-console-listener')

var listener = bcl(host)

Create a listener for the given host object. Pass window as host to achieve the desired effect in browser console.

listener.listen(answers, callback)

Listen for an answer.

answers

Array of strings. A getter will be defined on host object for each answer. There cannot already be a property on host object with same name as any answer.

callback

Function invoked when user types an answer. It is passed the selected answer (string).

listener.cancel()

Stop listening for answers. Remove getters from host object.

Install

npm install browser-console-listener

bower install browser-console-listener

License

MIT

Keywords

browser

FAQs

Package last updated on 27 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.