flux-actions
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("flux-actions",[],e):"object"==typeof exports?exports["flux-actions"]=e():t["flux-actions"]=e()}(this,function(){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={i:o,l:!1,exports:{}};return t[o].call(r.exports,r,r.exports,e),r.l=!0,r.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,o){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:o})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=0)}([function(t,e){}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("flux-actions",[],t):"object"==typeof exports?exports["flux-actions"]=t():e["flux-actions"]=t()}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.i=function(e){return e},t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(){function e(t){r(this,e),this._dispatcher=t}return o(e,[{key:"dispatch",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this._dispatcher.dispatch({type:e,payload:t})}},{key:"dispatchPromise",value:function(e,t){var n=this,r=t.request,o=t.success,u=t.fail,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};this.dispatch(r,i),e.then(function(e){return n.dispatch(o,{data:e,payload:i})},function(e){return n.dispatch(u,{data:e,payload:i})})}}]),e}();t.default=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(0);Object.keys(r).forEach(function(e){"default"!==e&&"__esModule"!==e&&Object.defineProperty(t,e,{enumerable:!0,get:function(){return r[e]}})})}])}); |
{ | ||
"name": "flux-actions", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"description": "Basic class that wrap flux actions.", | ||
@@ -5,0 +5,0 @@ "keywords": "flux, action", |
@@ -45,2 +45,4 @@ # Flux Actions | ||
* `dispatcher` - `Dispatcher` instance of flux `Dispatcher` | ||
### `dispatch(type, payload)` | ||
@@ -47,0 +49,0 @@ |
export default class Actions { | ||
/** | ||
* @param {Dispatcher} dispatcher - instance of flux `Dispatcher` | ||
*/ | ||
constructor(dispatcher) { | ||
@@ -6,2 +9,6 @@ this._dispatcher = dispatcher; | ||
/** | ||
* @param {string} type - action type | ||
* @param {object} payload - a payload object | ||
*/ | ||
dispatch(type, payload={}) { | ||
@@ -14,2 +21,7 @@ this._dispatcher.dispatch({ | ||
/** | ||
* @param {Promise} promise - instance of Promise | ||
* @param {request, success, fail} types - object with list of types request/success/fail | ||
* @param {object} payload - a payload object | ||
*/ | ||
dispatchPromise(promise, {request, success, fail}, payload={}) { | ||
@@ -16,0 +28,0 @@ this.dispatch(request, payload); |
96987
10
90
63