[Pkg-javascript-commits] [libjs-mousetrap] 01/05: Imported Upstream version 1.6.0+dfsg1

Alexandre Viau aviau at moszumanska.debian.org
Sun Jun 26 11:52:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

aviau pushed a commit to branch master
in repository libjs-mousetrap.

commit c28c3b0b4f91f3f11dec5c8154fd4690a240f325
Author: aviau <alexandre at alexandreviau.net>
Date:   Sun Jun 26 13:46:21 2016 +0200

    Imported Upstream version 1.6.0+dfsg1
---
 mousetrap.js | 23 ++++++++++++++++++++---
 package.json |  2 +-
 2 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/mousetrap.js b/mousetrap.js
index 8986af7..74e7e72 100644
--- a/mousetrap.js
+++ b/mousetrap.js
@@ -1,6 +1,6 @@
 /*global define:false */
 /**
- * Copyright 2015 Craig Campbell
+ * Copyright 2016 Craig Campbell
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,11 +17,16 @@
  * Mousetrap is a simple keyboard shortcut library for Javascript with
  * no external dependencies
  *
- * @version 1.5.2
+ * @version 1.6.0
  * @url craig.is/killing/mice
  */
 (function(window, document, undefined) {
 
+    // Check if mousetrap is used inside browser, if not, return
+    if (!window) {
+        return;
+    }
+
     /**
      * mapping of special keycodes to their corresponding keys
      *
@@ -984,6 +989,18 @@
     };
 
     /**
+     * allow custom key mappings
+     */
+    Mousetrap.addKeycodes = function(object) {
+        for (var key in object) {
+            if (object.hasOwnProperty(key)) {
+                _MAP[key] = object[key];
+            }
+        }
+        _REVERSE_MAP = null;
+    };
+
+    /**
      * Init the global mousetrap functions
      *
      * This method is needed to allow the global mousetrap functions to work
@@ -1018,4 +1035,4 @@
             return Mousetrap;
         });
     }
-}) (window, document);
+}) (typeof window !== 'undefined' ? window : null, typeof  window !== 'undefined' ? document : null);
diff --git a/package.json b/package.json
index 996eaf0..1118600 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "mousetrap",
-  "version": "1.5.3",
+  "version": "1.6.0",
   "description": "Simple library for handling keyboard shortcuts",
   "main": "mousetrap.js",
   "directories": {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/libjs-mousetrap.git



More information about the Pkg-javascript-commits mailing list