Skip to content

Commit

Permalink
Add new build process
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptex committed Apr 16, 2018
1 parent bafc6a8 commit 5d642cc
Show file tree
Hide file tree
Showing 7 changed files with 4,240 additions and 518 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ yarn add @three11/debounce
First, import the module:

```
import { debounce } from '@three11/debounce';
import debounce from '@three11/debounce';
```

Then use it to postpone a function's execution:
Expand All @@ -32,9 +32,9 @@ debounce(yourAwesomeFn());

`debounce(fn, wait, immediate)` accepts three arguments:

* `fn` : <Function> - the function to debounce
* `wait` : <Number> - miliseconds to wait before running the `fn` again
* `immediate` : <Boolean> - whether the function should run immediately
* `fn` : <Function> - the function to debounce
* `wait` : <Number> - miliseconds to wait before running the `fn` again
* `immediate` : <Boolean> - whether the function should run immediately

## License

Expand Down
95 changes: 93 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,95 @@
(function webpackUniversalModuleDefinition(root, factory) {
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define([], factory);
else if(typeof exports === 'object')
exports["debounce"] = factory();
else
root["debounce"] = factory();
})(window, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, {
/******/ configurable: false,
/******/ enumerable: true,
/******/ get: getter
/******/ });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


Object.defineProperty(exports, "__esModule", {
value: true
});
exports.debounce = void 0;
exports.default = void 0;

var _this = void 0,
_arguments = arguments;
Expand Down Expand Up @@ -33,4 +119,9 @@ var debounce = function debounce(func, wait, immediate) {
};
};

exports.debounce = debounce;
var _default = debounce;
exports.default = _default;

/***/ })
/******/ ])["default"];
});
1 change: 1 addition & 0 deletions dist/index.min.js

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

24 changes: 11 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
{
"name": "@three11/debounce",
"version": "0.2.0",
"version": "0.3.0",
"description": "Debounce multiple function executions",
"main": "dist/index.js",
"scripts": {
"build": "babel src -d dist"
"build": "webpack"
},
"repository": {
"type": "git",
"url": "git+https://github.com/three11/debounce.git"
},
"keywords": [
"Debounce",
"Function",
"Wait",
"JavaScript",
"ES2017"
],
"keywords": ["Debounce", "Function", "Wait", "JavaScript", "ES2017"],
"authors": [
{
"name": "Three 11 Ltd",
Expand All @@ -40,9 +34,13 @@
},
"homepage": "https://github.com/three11/debounce#readme",
"devDependencies": {
"@babel/cli": "^7.0.0-beta.42",
"@babel/core": "^7.0.0-beta.42",
"@babel/preset-env": "^7.0.0-beta.42",
"@babel/preset-stage-2": "^7.0.0-beta.42"
"@babel/cli": "^7.0.0-beta.44",
"@babel/core": "^7.0.0-beta.44",
"@babel/preset-env": "^7.0.0-beta.44",
"@babel/preset-stage-2": "^7.0.0-beta.44",
"babel-loader": "^8.0.0-beta",
"unminified-webpack-plugin": "^2.0.0",
"webpack": "^4.5.0",
"webpack-cli": "^2.0.14"
}
}
4 changes: 3 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const debounce = (func, wait, immediate) => {
const debounce = (func, wait, immediate) => {
let timeout;

wait = wait ? wait : 15;
Expand All @@ -24,3 +24,5 @@ export const debounce = (func, wait, immediate) => {
}
};
};

export default debounce;
21 changes: 21 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const UnminifiedWebpackPlugin = require('unminified-webpack-plugin');

module.exports = {
mode: 'production',
entry: './src/index.js',
output: {
filename: 'index.min.js',
library: 'debounce',
libraryTarget: 'umd',
libraryExport: 'default'
},
module: {
rules: [
{
test: /\.(js)$/,
loader: 'babel-loader'
}
]
},
plugins: [new UnminifiedWebpackPlugin()]
};
Loading

0 comments on commit 5d642cc

Please sign in to comment.