Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vuex-cache

Package Overview
Dependencies
Maintainers
2
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vuex-cache - npm Package Compare versions

Comparing version 1.4.1 to 2.1.0

CHANGELOG.md

24

dist/vuex-cache.cjs.js
/*!
* vuex-cache v1.4.1
* (c) 2017-present superwf@gmail.com
* vuex-cache v2.1.0
* (c) 2018-present superwf@gmail.com
* Released under the MIT License.

@@ -8,2 +8,4 @@ */

Object.defineProperty(exports, '__esModule', { value: true });
var isVuexStore = function isVuexStore(obj) {

@@ -75,3 +77,7 @@ return 'dispatch' in obj && typeof obj.dispatch === 'function';

if (!cache.has(type)) {
cache.set(type, store.dispatch.apply(store, args));
var action = store.dispatch.apply(store, args).catch(function (error) {
cache.delete(type);
return Promise.reject(error);
});
cache.set(type, action);
}

@@ -115,4 +121,12 @@

return cachePlugin(args);
};
}; // expose plugin as default
module.exports = resolveParams;
function cacheAction(action) {
return function cacheEnhancedAction(context, payload) {
cachePlugin(context);
return action(context, payload);
};
}
exports.default = resolveParams;
exports.cacheAction = cacheAction;
/*!
* vuex-cache v1.4.1
* (c) 2017-present superwf@gmail.com
* vuex-cache v2.1.0
* (c) 2018-present superwf@gmail.com
* Released under the MIT License.

@@ -72,3 +72,7 @@ */

if (!cache.has(type)) {
cache.set(type, store.dispatch.apply(store, args));
var action = store.dispatch.apply(store, args).catch(function (error) {
cache.delete(type);
return Promise.reject(error);
});
cache.set(type, action);
}

@@ -112,4 +116,12 @@

return cachePlugin(args);
};
}; // expose plugin as default
function cacheAction(action) {
return function cacheEnhancedAction(context, payload) {
cachePlugin(context);
return action(context, payload);
};
}
export default resolveParams;
export { cacheAction };
/*!
* vuex-cache v1.4.1
* (c) 2017-present superwf@gmail.com
* vuex-cache v2.1.0
* (c) 2018-present superwf@gmail.com
* Released under the MIT License.
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.vuexCache = factory());
}(this, (function () { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
typeof define === 'function' && define.amd ? define(['exports'], factory) :
(factory((global.vuexCache = {})));
}(this, (function (exports) { 'use strict';

@@ -78,3 +78,7 @@ var isVuexStore = function isVuexStore(obj) {

if (!cache.has(type)) {
cache.set(type, store.dispatch.apply(store, args));
var action = store.dispatch.apply(store, args).catch(function (error) {
cache.delete(type);
return Promise.reject(error);
});
cache.set(type, action);
}

@@ -118,6 +122,16 @@

return cachePlugin(args);
};
}; // expose plugin as default
return resolveParams;
function cacheAction(action) {
return function cacheEnhancedAction(context, payload) {
cachePlugin(context);
return action(context, payload);
};
}
exports.default = resolveParams;
exports.cacheAction = cacheAction;
Object.defineProperty(exports, '__esModule', { value: true });
})));
/*!
* vuex-cache v1.4.1
* (c) 2017-present superwf@gmail.com
* vuex-cache v2.1.0
* (c) 2018-present superwf@gmail.com
* Released under the MIT License.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.vuexCache=t()}(this,function(){"use strict";var a=function(e){return"string"==typeof e?e:JSON.stringify(e)},h=function(e){var t=a(e[0]);return e[1]&&(t="".concat(t,":").concat(a(e[1]))),t},n=function(f,c){var d=new Map,s=new Map;d.dispatch=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r,i,o=h(t),a=(i=c,1===(r=t).length&&r[0].timeout?r[0].timeout:3===r.length&&r[2].timeout?r[2].timeout:i&&i.timeout?i.timeout:0);if(a){var u=Date.now();if(s.has(o))s.get(o)<u-a&&(d.delete(o),s.delete(o));else s.set(o,u)}return d.has(o)||d.set(o,f.dispatch.apply(f,t)),d.get(o)};var i=d.has.bind(d);d.has=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=h(t);return i(a(r))};var o=d.delete.bind(d);d.delete=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=h(t);return o(a(r))},f.cache=d};return function(t){return"dispatch"in(e=t)&&"function"==typeof e.dispatch?n(t):function(e){return n(e,t)};var e}});
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(n.vuexCache={})}(this,function(n){"use strict";var e=function(n){return"string"==typeof n?n:JSON.stringify(n)},t=function(n){var t=e(n[0]);return n[1]&&(t="".concat(t,":").concat(e(n[1]))),t},r=function(n,r){var i=new Map,f=new Map;i.dispatch=function(){for(var e=arguments.length,o=new Array(e),u=0;u<e;u++)o[u]=arguments[u];var a=t(o),c=function(n,e){return 1===n.length&&n[0].timeout?n[0].timeout:3===n.length&&n[2].timeout?n[2].timeout:e&&e.timeout?e.timeout:0}(o,r);if(c){var d=Date.now();if(f.has(a))d-c>f.get(a)&&(i.delete(a),f.delete(a));else f.set(a,d)}if(!i.has(a)){var s=n.dispatch.apply(n,o).catch(function(n){return i.delete(a),Promise.reject(n)});i.set(a,s)}return i.get(a)};var o=i.has.bind(i);i.has=function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var f=t(r);return o(e(f))};var u=i.delete.bind(i);i.delete=function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];var f=t(r);return u(e(f))},n.cache=i};n.default=function(n){return"dispatch"in(e=n)&&"function"==typeof e.dispatch?r(n):function(e){return r(e,n)};var e},n.cacheAction=function(n){return function(e,t){return r(e),n(e,t)}},Object.defineProperty(n,"__esModule",{value:!0})});
//# sourceMappingURL=vuex-cache.min.js.map
{
"name": "vuex-cache",
"version": "1.4.1",
"version": "2.1.0",
"description": "cache vuex action",

@@ -13,2 +13,9 @@ "cdn": "dist/vuex-cache.min.js",

"author": "superwf@gmail.com",
"contributors": [
{
"url": "https://vitorluizc.github.io/",
"name": "Vitor Luiz Cavalcanti",
"email": "vitorluizc@outlook.com"
}
],
"license": "MIT",

@@ -20,7 +27,7 @@ "homepage": "https://github.com/superwf/vuex-cache",

"scripts": {
"test": "NODE_ENV=test npx jest",
"cover": "NODE_ENV=test npx jest --coverage",
"lint": "npx eslint src/index.js",
"test": "jest",
"cover": "jest --coverage",
"lint": "eslint src/index.js",
"build": "bili src/index.js --format es,cjs,umd,umd-min --banner",
"prepublish": "npm run lint && npm run cover && npm run build"
"prepublish": "yarn lint && yarn build && yarn cover"
},

@@ -32,27 +39,22 @@ "keywords": [

"devDependencies": {
"@babel/cli": "^7.0.0",
"@babel/core": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-export-default-from": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-stage-0": "^7.0.0",
"@babel/register": "^7.0.0",
"@babel/runtime": "^7.0.0",
"babel-7-jest": "^21.3.3",
"babel-eslint": "^9.0.0",
"babel-plugin-external-helpers": "^6.22.0",
"bili": "^3.3.0",
"eslint": "^5.3.0",
"eslint-config-prettier": "^2.9.0",
"eslint-config-standard": "^7.0.1",
"eslint-plugin-jest": "^21.17.0",
"eslint-plugin-prettier": "^3.0.0",
"@babel/core": "^7.2.2",
"@babel/plugin-transform-runtime": "^7.2.0",
"@babel/preset-env": "^7.2.3",
"@babel/runtime": "^7.2.0",
"babel-core": "^7.0.0-bridge",
"babel-eslint": "^10.0.1",
"babel-jest": "^23.6.0",
"bili": "^3.4.2",
"eslint": "^5.11.1",
"eslint-config-prettier": "^3.3.0",
"eslint-config-standard": "^12.0.0",
"eslint-plugin-import": "^2.14.0",
"eslint-plugin-jest": "^22.1.2",
"eslint-plugin-node": "^8.0.0",
"eslint-plugin-prettier": "^3.0.1",
"eslint-plugin-promise": "^4.0.1",
"eslint-plugin-standard": "^2.1.1",
"jest": "^23.1.0",
"prettier": "^1.13.5",
"vue": "^2.5.17",
"eslint-plugin-standard": "^4.0.0",
"jest": "^23.6.0",
"prettier": "^1.15.3",
"vue": "^2.5.21",
"vuex": "^3.0.1"

@@ -68,11 +70,5 @@ },

"transform": {
"^.+\\.js$": "<rootDir>/node_modules/babel-7-jest"
},
"moduleFileExtensions": [
"js",
"json",
"jsx",
"node"
]
"^.+\\.js$": "babel-jest"
}
}
}

@@ -1,13 +0,23 @@

# vuex cache action
# vuex-cache
When vuex action fetch some data by request remote api, vuex-cache can store the action result, when next time the same action runs, it will not make a new request and just return the cached result.
#### 2018-09-21
## Compatibility
update to use babel7 env to compile. If there is something wrong, please let me know by issue.
- Any Vue version, since `vuex-cache` just deals with Vuex;
- Vuex versions 1, 2 and 3.
#### 2018-10-11
## Installation
##### NEW FEATUE, add `timeout` option
`vuex-cache` is published in the NPM registry and can be installed using any compatible package manager.
```sh
npm install vuex-cache --save
# Use the command below if you're using Yarn.
yarn add vuex-cache
```
##### NEW FEATURE, add `timeout` option
```javascript

@@ -60,11 +70,2 @@ store.cache.dispatch({

### Compatibility
- Any Vue version, since `vuex-cache` just deals with Vuex
- Vuex versions 1, 2 and 3
### install
```bash
npm install vuex-cache
```
### usage

@@ -71,0 +72,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc