Skip to content

Commit

Permalink
add esm source module
Browse files Browse the repository at this point in the history
  • Loading branch information
mojoaxel committed Oct 7, 2020
1 parent 3410b56 commit 3914648
Show file tree
Hide file tree
Showing 5 changed files with 390 additions and 25 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea/
node_modules/
34 changes: 10 additions & 24 deletions keycharm.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,12 @@
"use strict";
/**
* Created by Alex on 11/6/2014.
*/

// https://github.com/umdjs/umd/blob/master/returnExports.js#L40-L60
// if the module has no dependencies, the above pattern can be simplified to
(function (root, factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module.
define([], factory);
} else if (typeof exports === 'object') {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory();
} else {
// Browser globals (root is window)
root.keycharm = factory();
}
}(this, function () {

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.keycharm = factory());
}(this, (function () { 'use strict';

/**
* Created by Alex on 11/6/2014.
*/
function keycharm(options) {
var preventDefault = options && options.preventDefault || false;

Expand Down Expand Up @@ -188,6 +175,5 @@
}

return keycharm;
}));


})));
198 changes: 198 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
"description": "Simple, lightweight key-binding lib",
"version": "0.3.0",
"license": "(Apache-2.0 OR MIT)",
"repository": "https://github.com/AlexDM0/keycharm",
"main": "keycharm.js",
"repository": "https://github.com/AlexDM0/keycharm"
"module": "./src/keycharm.js",
"scripts": {
"build": "rollup ./src/keycharm.js --file keycharm.js --format umd --output.name keycharm"
},
"pre-commit": [
"build"
],
"devDependencies": {
"pre-commit": "^1.2.2",
"rollup": "^2.28.2"
}
}
Loading

0 comments on commit 3914648

Please sign in to comment.