angular-http-cache
Advanced tools
Comparing version 1.0.5 to 1.0.6
{ | ||
"name": "angular-http-cache", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "An angular module that sits on top of $http and adds caching support and application wide notifications when cached data is updated.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
'use strict'; | ||
angular.module('angular-http-cache', []) | ||
angular.module('angular-http-cache', ['angular-local-db']) | ||
.service('$httpCache', | ||
@@ -8,2 +8,10 @@ ['$http', '$localDb', '$rootScope', '$q', | ||
/** | ||
* @param {object} object | ||
* @param {string} object.collection | ||
* @param {boolean} object.caching | ||
* @param {string} object.domain | ||
* @return {httpCache} | ||
* @api public | ||
*/ | ||
var httpCache = function (options) { | ||
@@ -20,2 +28,9 @@ if (!(this instanceof httpCache)) { | ||
/** | ||
* @param {string|int} id | ||
* @param {object} params | ||
* @param {boolean} params.ignoreCache | ||
* @return Promise | ||
* @api public | ||
*/ | ||
httpCache.prototype.get = function (id, params) { | ||
@@ -47,2 +62,9 @@ return $q((function (resolve, reject) { | ||
/** | ||
* @param {object} params | ||
* @param {boolean} params.ignoreCache | ||
* @param {string|int} params.index | ||
* @return Promise | ||
* @api public | ||
*/ | ||
httpCache.prototype.fetch = function (params) { | ||
@@ -81,2 +103,7 @@ return $q((function (resolve, reject) { | ||
/** | ||
* @param {object} data | ||
* @return Promise | ||
* @api public | ||
*/ | ||
httpCache.prototype.create = function (data, callback) { | ||
@@ -99,2 +126,7 @@ return $q((function (resolve, reject) { | ||
/** | ||
* @param {object} doc | ||
* @return Promise | ||
* @api public | ||
*/ | ||
httpCache.prototype.update = function (doc, callback) { | ||
@@ -105,3 +137,3 @@ return $q((function (resolve, reject) { | ||
$http({method: 'PUT', url: '/' + this._getUrlPredicate(), data:{doc:doc}}) | ||
$http({method: 'PUT', url: '/' + this._getUrlPredicate() + '/' + doc.id, data:{doc:doc}}) | ||
.success((function (data, status, headers, config) { | ||
@@ -117,2 +149,9 @@ this._handleDoc(data.doc); | ||
/** | ||
* @param {string|int} id | ||
* @param {string|int} prop | ||
* @param {string|int|array|object} value | ||
* @return Promise | ||
* @api public | ||
*/ | ||
httpCache.prototype.patch = function (id, prop, value, callback) { | ||
@@ -135,2 +174,7 @@ return $q((function (resolve, reject) { | ||
/** | ||
* @param {string|int} id | ||
* @return Promise | ||
* @api public | ||
*/ | ||
httpCache.prototype.delete = function (id, callback) { | ||
@@ -153,2 +197,5 @@ return $q((function (resolve, reject) { | ||
/** | ||
* @api public | ||
*/ | ||
httpCache.prototype.initIndexes = function () { | ||
@@ -158,2 +205,6 @@ this._indexMap = {}; | ||
/** | ||
* @param {string} collection | ||
* @api public | ||
*/ | ||
httpCache.prototype.setCollection = function (collection) { | ||
@@ -163,2 +214,5 @@ this._collection = collection; | ||
/** | ||
* @api public | ||
*/ | ||
httpCache.prototype.getCollection = function () { | ||
@@ -168,2 +222,6 @@ return this._collection; | ||
/** | ||
* @param {boolean} caching | ||
* @api public | ||
*/ | ||
httpCache.prototype.setDocCaching = function (caching) { | ||
@@ -173,2 +231,5 @@ this._caching = caching; | ||
/** | ||
* @api public | ||
*/ | ||
httpCache.prototype.getDocCaching = function () { | ||
@@ -178,2 +239,6 @@ return this._caching; | ||
/** | ||
* @param {string} domain | ||
* @api public | ||
*/ | ||
httpCache.prototype.setDomain = function (domain) { | ||
@@ -183,2 +248,5 @@ this._domain = domain; | ||
/** | ||
* @api public | ||
*/ | ||
httpCache.prototype.getDomain = function () { | ||
@@ -188,2 +256,5 @@ return this._domain; | ||
/** | ||
* @api private | ||
*/ | ||
httpCache.prototype._init = function () { | ||
@@ -196,2 +267,5 @@ this.initIndexes(); | ||
/** | ||
* @api private | ||
*/ | ||
httpCache.prototype._getUrlPredicate = function () { | ||
@@ -201,2 +275,5 @@ return this._domain ? this._domain + '/' + this._collection : this._collection; | ||
/** | ||
* @api private | ||
*/ | ||
httpCache.prototype._getCacheKey = function () { | ||
@@ -206,3 +283,5 @@ return this._domain ? this._domain + ':' + this._collection : this._collection; | ||
/** | ||
* @api private | ||
*/ | ||
httpCache.prototype._getCacheBroadcastPredicate = function () { | ||
@@ -212,2 +291,5 @@ return this._domain ? this._domain + '-' + this._collection : this._collection; | ||
/** | ||
* @api private | ||
*/ | ||
httpCache.prototype._handleDoc = function (doc, index, secondary) { | ||
@@ -230,2 +312,5 @@ if (!doc || !this._caching) return; | ||
/** | ||
* @api private | ||
*/ | ||
httpCache.prototype._handleDocRemoval = function (id) { | ||
@@ -250,2 +335,5 @@ if (!id || !this._caching) return; | ||
/** | ||
* @api private | ||
*/ | ||
httpCache.prototype._catchExecute = function (method, params) { | ||
@@ -252,0 +340,0 @@ if (!this._collection) { |
{ | ||
"name": "angular-http-cache", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "An angular module that sits on top of $http and adds caching support and application wide notifications when cached data is updated. ", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16224
410