]> git.wincent.com - hextrapolate.git/commitdiff
Switch from local debounce() to NPM package
authorGreg Hurrell <greg@hurrell.net>
Tue, 4 Aug 2015 17:41:21 +0000 (10:41 -0700)
committerGreg Hurrell <greg@hurrell.net>
Tue, 4 Aug 2015 17:41:21 +0000 (10:41 -0700)
package.json
src/App.js
src/debounce.js [deleted file]

index e2bd79dbbe61b238fd05028c5b3f821a46376701..f5d513419583ca4b3fa18ff9e071a3075fde7bf6 100644 (file)
@@ -42,6 +42,7 @@
   },
   "dependencies": {
     "classnames": "^2.1.3",
   },
   "dependencies": {
     "classnames": "^2.1.3",
-    "react": "^0.13.0"
+    "react": "^0.13.0",
+    "simple-debounce": "0.0.3"
   }
 }
   }
 }
index 32cc1e14fa3b22c3e13ba002d2508f8eca3adf21..3f7ccd6bce537d4cffaec2fae5570d5aa967db20 100644 (file)
@@ -15,7 +15,7 @@ import React from 'react';
 import Size from './Size.react';
 import type Value from './Field.react';
 import convert from './convert';
 import Size from './Size.react';
 import type Value from './Field.react';
 import convert from './convert';
-import debounce from './debounce';
+import debounce from 'simple-debounce';
 
 import './App.css';
 
 
 import './App.css';
 
diff --git a/src/debounce.js b/src/debounce.js
deleted file mode 100644 (file)
index 667819a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/**
- * Copyright 2003-present Greg Hurrell. All rights reserved.
- * Licensed under the terms of the MIT license.
- *
- * @flow
- */
-
-'use strict';
-
-/**
- * Debounce implementation that fires on the trailing edge only. If a call comes
- * in when a pending call is yet to be finalized, it replaces the pending call.
- */
-export default function debounce(fn, interval) {
-  let timeout = null;
-  return function() {
-    const args = arguments;
-    const context = this;
-    clearTimeout(timeout);
-    timeout = setTimeout(() => fn.apply(context, args), interval);
-  };
-}