Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

keycharm

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keycharm - npm Package Compare versions

Comparing version 0.1.5 to 0.1.6

22

keycharm.js

@@ -0,1 +1,2 @@

"use strict";
/**

@@ -25,2 +26,3 @@ * Created by Alex on 11/6/2014.

var _exportFunctions = {};
var _bound = {keydown:{}, keyup:{}};

@@ -98,3 +100,3 @@ var _keys = {};

// bind a key to a callback
this.bind = function(key, callback, type) {
_exportFunctions.bind = function(key, callback, type) {
if (type === undefined) {

@@ -114,9 +116,9 @@ type = 'keydown';

// bind all keys to a call back (demo purposes)
this.bindAll = function(callback, type) {
_exportFunctions.bindAll = function(callback, type) {
if (type === undefined) {
type = 'keydown';
}
for (key in _keys) {
for (var key in _keys) {
if (_keys.hasOwnProperty(key)) {
this.bind(key,callback,type);
_exportFunctions.bind(key,callback,type);
}

@@ -127,4 +129,4 @@ }

// get the key label from an event
this.getKey = function(event) {
for (key in _keys) {
_exportFunctions.getKey = function(event) {
for (var key in _keys) {
if (_keys.hasOwnProperty(key)) {

@@ -146,3 +148,3 @@ if (event.shiftKey == true && _keys[key].shift == true && event.keyCode == _keys[key].code) {

// unbind either a specific callback from a key or all of them (by leaving callback undefined)
this.unbind = function(key, callback, type) {
_exportFunctions.unbind = function(key, callback, type) {
if (type === undefined) {

@@ -172,3 +174,3 @@ type = 'keydown';

// reset all bound variables.
this.reset = function() {
_exportFunctions.reset = function() {
_bound = {keydown:{}, keyup:{}};

@@ -178,3 +180,3 @@ };

// unbind all listeners and reset all variables.
this.destroy = function() {
_exportFunctions.destroy = function() {
_bound = {keydown:{}, keyup:{}};

@@ -190,3 +192,3 @@ window.removeEventListener('keydown', down, true);

// return the public functions.
return this;
return _exportFunctions;
}

@@ -193,0 +195,0 @@

@@ -5,5 +5,5 @@ {

"description": "Simple, lightweight key-binding lib",
"version": "0.1.5",
"version": "0.1.6",
"main": "keycharm.js",
"repository": "https://github.com/AlexDM0/keycharm"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc