Skip to content

Commit

Permalink
Upgrade package
Browse files Browse the repository at this point in the history
  • Loading branch information
niksy committed Jun 8, 2018
1 parent 56087b9 commit 3a39f10
Show file tree
Hide file tree
Showing 8 changed files with 140 additions and 91 deletions.
5 changes: 4 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{
"root": true,
"extends": [
"niksy"
"niksy",
"niksy/next",
"niksy/browser"
]
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.DS_Store
node_modules/
package-lock.json
yarn.lock
npm-debug.log
test-dist/
index.cjs.js
index.esm.js
dist/
16 changes: 16 additions & 0 deletions .rollup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
'use strict';


module.exports = {
input: 'index.js',
output: [
{
file: 'index.cjs.js',
format: 'cjs'
},
{
file: 'index.esm.js',
format: 'es'
}
]
};
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
language: node_js
node_js:
- '4'
before_install:
- export CHROME_BIN=chromium-browser
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sleep 3
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[![Build Status][ci-img]][ci]

Throttle/debounce your functions.
Throttle and debounce functions.

This module is the same as [jquery-throttle-debounce][jquery-throttle-debounce] ([with some differences](#differences-with-original-module)), but it’s transferred to CommonJS so it can be easily used with tools like Browserify or Webpack.

Expand Down Expand Up @@ -90,13 +90,17 @@ A function to be executed after delay milliseconds. The `this` context and all a

## Browser support

Tested in IE8+ and all modern browsers.
Tested in IE9+ and all modern browsers.

## Test

For local automated tests, run `npm run test:automated:local` (append `:watch` for watcher support).

## License

**Original module license:** Copyright (c) 2010 "Cowboy" Ben Alman (Dual licensed under the MIT and GPL licenses. http://benalman.com/about/license/)
**This module license:** MIT © [Ivan Nikolić](http://ivannikolic.com)

[ci]: https://travis-ci.org/niksy/throttle-debounce
[ci-img]: https://img.shields.io/travis/niksy/throttle-debounce/master.svg
[ci-img]: https://travis-ci.org/niksy/throttle-debounce.svg?branch=master
[jquery-throttle-debounce]: https://github.com/cowboy/jquery-throttle-debounce
124 changes: 54 additions & 70 deletions karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,70 +1,54 @@
// Karma configuration
// Generated on Sun May 01 2016 16:50:20 GMT+0200 (CEST)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['browserify', 'qunit'],


// list of files / patterns to load in the browser
files: [
'test/**/*.js'
],


// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'test/**/*.js': 'browserify'
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['mocha'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome', 'Firefox'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
/* globals process:false */
/* eslint-disable no-process-env */

'use strict';

module.exports = function ( config ) {

config.set({
basePath: '',
frameworks: ['browserify', 'qunit'],
files: [
'test/**/*.html',
'test/**/*.js'
],
exclude: [],
preprocessors: {
'test/**/*.html': ['html2js'],
'test/**/*.js': ['browserify']
},
reporters: ['mocha'],
port: 9001,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: false,
client: {
captureConsole: true,
mocha: {
ui: 'bdd'
}
},
browserConsoleLogOptions: {
level: 'log',
format: '%b %T: %m',
terminal: true
},
browserify: {
debug: true,
transform: [
['rollupify', { config: '.rollup.js', sourceMaps: true }],

]
},
customLaunchers: {
'Chrome-CI': {
base: 'Chrome',
flags: ['--no-sandbox']
}
},
browsers: [(process.env.TRAVIS ? 'Chrome-CI' : 'Chrome')],
singleRun: true,
concurrency: Infinity
});

};
58 changes: 41 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,44 +1,68 @@
{
"name": "throttle-debounce",
"version": "1.1.0",
"description": "Throttle/debounce your functions.",
"main": "index.js",
"typings": "index.d.ts",
"author": "Ivan Nikolić <[email protected]> (http://ivannikolic.com/)",
"description": "Throttle and debounce functions.",
"main": "index.cjs.js",
"module": "index.esm.js",
"author": "Ivan Nikolić <[email protected]> (http://ivannikolic.com)",
"contributors": [
"Ben Alman (http://benalman.com)"
],
"license": "MIT",
"engines": {
"node": ">=4"
},
"files": [
"index.cjs.js",
"index.esm.js",
"index.d.ts",
"LICENSE.md",
"README.md"
],
"sideEffects": false,
"typings": "index.d.ts",
"directories": {
"test": "test"
},
"scripts": {
"test": "eslint {index,test/*}.js && karma start --single-run --browsers PhantomJS"
"build": "rollup --config .rollup.js",
"lint": "eslint {index,throttle,debounce}.js",
"prepublish": "npm run build",
"test": "npm run lint && npm run test:automated",
"test:automated": "karma start",
"test:automated:local": "karma start --browsers Chrome",
"test:automated:local:watch": "npm run test:automated:local -- --auto-watch --no-single-run"
},
"dependencies": {},
"devDependencies": {
"browserify": "^13.0.0",
"eslint": "^1.10.3",
"eslint-config-niksy": "^1.0.6",
"karma": "^0.13.22",
"karma-browserify": "^5.0.4",
"karma-chrome-launcher": "^0.2.3",
"eslint": "^4.19.1",
"eslint-config-niksy": "^5.0.0",
"eslint-plugin-extend": "^0.1.1",
"eslint-plugin-mocha": "^4.9.0",
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-react": "^7.9.1",
"eslint-plugin-unicorn": "^4.0.3",
"karma": "^1.1.0",
"karma-browserify": "^5.0.5",
"karma-chrome-launcher": "^1.0.1",
"karma-firefox-launcher": "^0.1.7",
"karma-mocha-reporter": "^2.0.2",
"karma-html2js-preprocessor": "^1.0.0",
"karma-mocha": "^1.3.0",
"karma-mocha-reporter": "^2.2.5",
"karma-phantomjs-launcher": "^1.0.0",
"karma-qunit": "^0.1.9",
"mocha": "^2.4.5",
"mocha": "^4.1.0",
"phantomjs-prebuilt": "^2.1.7",
"qunitjs": "^1.23.1",
"rollup": "^0.60.1",
"rollupify": "^0.5.0",
"watchify": "^3.7.0"
},
"engines": {
"node": ">=4"
},
"keywords": [
"throttle",
"debounce",
"browserify"
"throttle"
],
"repository": {
"type": "git",
Expand Down
7 changes: 7 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": [
"niksy",
"niksy/next",
"niksy/tests"
]
}

0 comments on commit 3a39f10

Please sign in to comment.