Преглед изворни кода

Fixed the destructing/spread argument issue with @kvz and @hedgerh

Artur Paikin пре 9 година
родитељ
комит
78076ca333
4 измењених фајлова са 93 додато и 25 уклоњено
  1. 9 8
      src/core/Utils.js
  2. 3 3
      website/_config.yml
  3. 70 2
      website/src/api/docs.md
  4. 11 12
      website/themes/uppy/source/uppy/uppy.js

+ 9 - 8
src/core/Utils.js

@@ -1,11 +1,12 @@
-// /**
-// * Runs a waterfall of promises: calls each task, passing the result
-// * from the previous one as an argument. The first task is run with an empty array.
-// *
-// * @param {Array} tasks an array of Promises to run waterfall on
-// * @return {Promise} of the last task
-// */
-function promiseWaterfall([resolvedPromise, ...tasks]) {
+/**
+* Runs a waterfall of promises: calls each task, passing the result
+* from the previous one as an argument. The first task is run with an empty array.
+*
+* @param {Array} methods an array of Promises to run waterfall on
+* @return {Promise} of the last task
+*/
+function promiseWaterfall(methods) {
+  [resolvedPromise, ...tasks] = methods;
   const finalTaskPromise = tasks.reduce(function (prevTaskPromise, task) {
   const finalTaskPromise = tasks.reduce(function (prevTaskPromise, task) {
     return prevTaskPromise.then(task);
     return prevTaskPromise.then(task);
   }, resolvedPromise([]));  // initial value
   }, resolvedPromise([]));  // initial value

+ 3 - 3
website/_config.yml

@@ -5,9 +5,9 @@
 # Uppy versions, auto updated by update.js
 # Uppy versions, auto updated by update.js
 uppy_version: 0.0.1
 uppy_version: 0.0.1
 
 
-uppy_dev_size: "87.57"
-uppy_min_size: "87.57"
-uppy_gz_size: "87.57"
+uppy_dev_size: "87.55"
+uppy_min_size: "87.55"
+uppy_gz_size: "87.55"
 
 
 # Theme
 # Theme
 google_analytics: UA-63083-12
 google_analytics: UA-63083-12

+ 70 - 2
website/src/api/docs.md

@@ -63,11 +63,11 @@ basically a stripped-down version of it. Differences: pluralization functions ar
 and can be easily added among with dictionaries, nested objects are used for pluralization
 and can be easily added among with dictionaries, nested objects are used for pluralization
 as opposed to `||||` delimeter
 as opposed to `||||` delimeter
 
 
-Usage example: \`translator.t('files\_chosen', {smart\_count: 3})``
+Usage example: `translator.t('files_chosen', {smart_count: 3})`
 
 
 **Parameters**
 **Parameters**
 
 
--   `opts`  
+-   `opts` **object** 
 
 
 ### interpolate
 ### interpolate
 
 
@@ -107,6 +107,30 @@ this deciding on structure.
 
 
 Returns **array or string** files or success/fail message
 Returns **array or string** files or success/fail message
 
 
+## addClass
+
+Adds a class to a DOM element
+
+**Parameters**
+
+-   `el` **String** selector
+-   `className` **String** to add
+
+Returns **String** 
+
+## addListenerMulti
+
+Adds multiple listeners to to a DOM element
+Equvalent to jQuery’s `$form.on('drag dragstart dragend dragover dragenter dragleave drop')`.
+
+**Parameters**
+
+-   `el` **String** selector
+-   `events` **String** to add, like `drag dragstart dragend dragover dragenter dragleave drop`
+-   `cb` **requestCallback** 
+
+Returns **String** 
+
 ## DragDrop
 ## DragDrop
 
 
 Drag & Drop plugin
 Drag & Drop plugin
@@ -122,6 +146,28 @@ Checks if the browser supports Drag & Drop
 
 
 Returns **object** true if supported, false otherwise
 Returns **object** true if supported, false otherwise
 
 
+## promiseWaterfall
+
+Runs a waterfall of promises: calls each task, passing the result
+from the previous one as an argument. The first task is run with an empty array.
+
+**Parameters**
+
+-   `methods` **Array** an array of Promises to run waterfall on
+
+Returns **Promise** of the last task
+
+## removeClass
+
+Removes a class to a DOM element
+
+**Parameters**
+
+-   `el` **String** selector
+-   `className` **String** to remove
+
+Returns **String** 
+
 ## Tus10
 ## Tus10
 
 
 Tus resumable file uploader
 Tus resumable file uploader
@@ -131,6 +177,16 @@ Tus resumable file uploader
 -   `core`  
 -   `core`  
 -   `opts`  
 -   `opts`  
 
 
+### run
+
+Add files to an array of `upload()` calles, passing the current and total file count numbers
+
+**Parameters**
+
+-   `results` **array or object** 
+
+Returns **Promise** of parallel uploads `Promise.all(uploaders)`
+
 ### upload
 ### upload
 
 
 Create a new Tus upload
 Create a new Tus upload
@@ -142,3 +198,15 @@ Create a new Tus upload
 -   `total` **integer** number of files in a queue
 -   `total` **integer** number of files in a queue
 
 
 Returns **Promise** 
 Returns **Promise** 
+
+## toggleClass
+
+Toggles a class on a DOM element
+This is how we roll $('.element').toggleClass in a non-jQuery world
+
+**Parameters**
+
+-   `el` **String** selector
+-   `className` **String** to toggle
+
+Returns **String** 

+ 11 - 12
website/themes/uppy/source/uppy/uppy.js

@@ -2119,13 +2119,13 @@ exports['default'] = Translator;
 module.exports = exports['default'];
 module.exports = exports['default'];
 
 
 },{}],7:[function(require,module,exports){
 },{}],7:[function(require,module,exports){
-// /**
-// * Runs a waterfall of promises: calls each task, passing the result
-// * from the previous one as an argument. The first task is run with an empty array.
-// *
-// * @param {Array} tasks an array of Promises to run waterfall on
-// * @return {Promise} of the last task
-// */
+/**
+* Runs a waterfall of promises: calls each task, passing the result
+* from the previous one as an argument. The first task is run with an empty array.
+*
+* @param {Array} methods an array of Promises to run waterfall on
+* @return {Promise} of the last task
+*/
 'use strict';
 'use strict';
 
 
 Object.defineProperty(exports, '__esModule', {
 Object.defineProperty(exports, '__esModule', {
@@ -2134,12 +2134,11 @@ Object.defineProperty(exports, '__esModule', {
 
 
 function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
 function _toArray(arr) { return Array.isArray(arr) ? arr : Array.from(arr); }
 
 
-function promiseWaterfall(_ref) {
-  var _ref2 = _toArray(_ref);
-
-  var resolvedPromise = _ref2[0];
+function promiseWaterfall(methods) {
+  var _methods = _toArray(methods);
 
 
-  var tasks = _ref2.slice(1);
+  resolvedPromise = _methods[0];
+  tasks = _methods.slice(1);
 
 
   var finalTaskPromise = tasks.reduce(function (prevTaskPromise, task) {
   var finalTaskPromise = tasks.reduce(function (prevTaskPromise, task) {
     return prevTaskPromise.then(task);
     return prevTaskPromise.then(task);