Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Gruntfile.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ module.exports = (grunt) ->
src: 'lib/<%= name %>.js'
template: 'umd.hbs'
amdModuleId: '<%= pkg.name %>'
objectToExport: '<%= name %>'
globalAlias: '<%= name %>'
objectToExport: 'simpleHotkeys'
globalAlias: 'simpleHotkeys'
deps:
'default': ['$', 'SimpleModule']
amd: ['jquery', 'simple-module']
Expand Down
10 changes: 5 additions & 5 deletions lib/hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define('simple-hotkeys', ["jquery","simple-module"], function ($, SimpleModule) {
return (root['hotkeys'] = factory($, SimpleModule));
return (root['simpleHotkeys'] = factory($, SimpleModule));
});
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
Expand All @@ -11,11 +11,11 @@
module.exports = factory(require("jquery"),require("simple-module"));
} else {
root.simple = root.simple || {};
root.simple['hotkeys'] = factory(jQuery,SimpleModule);
root['simpleHotkeys'] = factory(root["jQuery"],root["SimpleModule"]);
}
}(this, function ($, SimpleModule) {

var Hotkeys, hotkeys,
var Hotkeys, simpleHotkeys,
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;

Expand Down Expand Up @@ -231,11 +231,11 @@ Hotkeys = (function(superClass) {

})(SimpleModule);

hotkeys = function(opts) {
simpleHotkeys = function(opts) {
return new Hotkeys(opts);
};

return hotkeys;
return simpleHotkeys;

}));

39 changes: 39 additions & 0 deletions spec/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Jasmine Spec Runner</title>
<link rel="shortcut icon" type="image/png" href=".grunt/grunt-contrib-jasmine/jasmine_favicon.png">

<link rel="stylesheet" type="text/css" href="../.grunt/grunt-contrib-jasmine/jasmine.css">

<link rel="stylesheet" type="text/css" href="../styles/hotkeys.css">


</head>
<body>


<script src="../.grunt/grunt-contrib-jasmine/es5-shim.js"></script>

<script src="../.grunt/grunt-contrib-jasmine/jasmine.js"></script>

<script src="../.grunt/grunt-contrib-jasmine/jasmine-html.js"></script>

<script src="../.grunt/grunt-contrib-jasmine/json2.js"></script>

<script src="../.grunt/grunt-contrib-jasmine/boot.js"></script>

<script src="../vendor/bower/jquery/dist/jquery.min.js"></script>

<script src="../vendor/bower/simple-module/lib/module.js"></script>

<script src="../lib/hotkeys.js"></script>

<script src="hotkeys-spec.js"></script>

<script src="../.grunt/grunt-contrib-jasmine/reporter.js"></script>


</body>
</html>
4 changes: 2 additions & 2 deletions src/hotkeys.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Hotkeys extends SimpleModule

# Punctuation keys that don't require holding down Shift
# Hyphen is nonportable: FF returns same code as Subtract
59:";", 61:"=", 186:";", 187:"=", # Firefox and Opera return 59,61
59:";", 61:"=", 186:";", 187:"=", # Firefox and Opera return 59,61
188:",", 190:".", 191:"/", 192:"`", 219:"[", 220:"\\", 221:"]", 222:"'"

@aliases:
Expand Down Expand Up @@ -90,5 +90,5 @@ class Hotkeys extends SimpleModule
@_map = {}
@

hotkeys = (opts) ->
simpleHotkeys = (opts) ->
new Hotkeys(opts)
2 changes: 1 addition & 1 deletion umd.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
module.exports = factory({{{cjsDependencies.wrapped}}});
} else {
root.simple = root.simple || {};
{{#if globalAlias}}root.simple['{{{globalAlias}}}'] = {{else}}{{#if objectToExport}}root['{{{objectToExport}}}'] = {{/if}}{{/if}}factory({{{globalDependencies.normal}}});
{{#if globalAlias}}root['{{{globalAlias}}}'] = {{else}}{{#if objectToExport}}root['{{{objectToExport}}}'] = {{/if}}{{/if}}factory({{{globalDependencies.normal}}});
}
}(this, function ({{dependencies}}) {

Expand Down
Loading