ng-current
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -55,7 +55,11 @@ ;(function(angular) { | ||
if (generator instanceof Function) { | ||
generator.call(service).then(function(data) { | ||
andThen( | ||
data instanceof Array ? data.map(service.model) : service.model(data) | ||
) | ||
}) | ||
$q.when(generator.call(service)) | ||
.then(function(data) { | ||
andThen( | ||
data instanceof Array ? data.map(service.model, service) : service.model(data) | ||
) | ||
}) | ||
.catch(function(error) { | ||
$log.error('[ng-current.refreshing] failed to refresh Service integration point', error) | ||
}) | ||
} else { | ||
@@ -62,0 +66,0 @@ $log.error('[ng-current.refreshing] failed to find method on service', method) |
@@ -1,1 +0,1 @@ | ||
!function(a){"use strict";var b=a.module("ng-current",[]);b.service("Contexts",["$log","$rootScope","$q",function(b,c,d){var e=this;this.contexts={},c.current={},this.register=function(a){this.contexts[a.name]=a.rels||[],a.refresh=e.refreshing(a),a.use=e.using(a),a.constructor.prototype=this.constructor.prototype,c.current[name]={}},this.refreshing=function(a){return function(c,d){var e=a[c];a.model||function(a){return a};e instanceof Function?e().then(function(b){d(b instanceof Array?b.map(a.model):a.model(b))}):b.error("[ng-current.refreshing] failed to find method on service",c)}},this.using=function(a){return function(c,d){a.constructor.prototype===this.constructor.prototype?(a.refresh(c,d),e.subscribe(a.name,function(b){a.refresh(c,d),a.rels&&a.rels.length&&a.rels.forEach(function(a){e.publish(a,b)})})):b.error("[ng-current.using] malformed Service context, please ensure you have added `Contexts.register(this)` at the end of this service",a)}},this.clear=function(a){(e.contexts[a]||[]).forEach(function(a){delete c.current[a];var b=e.contexts[a];b instanceof Array&&b.length&&b.forEach(e.clear)})},this.select=function(b,d){var f=c.current[b];a.equals(d,f)||(c.current[b]=d,e.clear(b),e.publish(b,d))},this.current=function(a){return c.current[a]},this.currentOr=function(b,c){var d=this.current(b);return a.isObject(d)||a.isUndefined(c)?d:c},this.get=e.current,this.getOr=e.currentOr,this.subscribe=function(a,b){return d(function(d,e){c.$on(a,function(a,c){d(b(c||{},a))})})},this.publish=function(a,b){var d=e.contexts[a],f=d?[a].concat(d):[a];f.forEach(function(a){if(a.constructor!==String)throw"rels must be Strings";c.$broadcast(a,b)})}}])}(angular),module&&exports&&module.exports===exports&&(module.exports="ng-current"); | ||
!function(a){"use strict";var b=a.module("ng-current",[]);b.service("Contexts",["$log","$rootScope","$q",function(b,c,d){var e=this;this.contexts={},c.current={},this.register=function(a){this.contexts[a.name]=a.rels||[],a.refresh=e.refreshing(a),a.use=e.using(a),a.$$hasContext=!0,c.current[name]={}},this.refreshing=function(a){return function(c,e){var f=a[c];a.model||function(a){return a};f instanceof Function?d.when(f.call(a)).then(function(b){e(b instanceof Array?b.map(a.model,a):a.model(b))})["catch"](function(a){b.error("[ng-current.refreshing] failed to refresh Service integration point",a)}):b.error("[ng-current.refreshing] failed to find method on service",c)}},this.using=function(a){return function(c,d){a.$$hasContext?(a.refresh(c,d),e.subscribe(a.name,function(b){a.refresh(c,d),a.rels&&a.rels.length&&a.rels.forEach(function(a){e.publish(a,b)})})):b.error("[ng-current.using] malformed Service context, please ensure you have added `Contexts.register(this)` at the end of this service",a)}},this.clear=function(a){(e.contexts[a]||[]).forEach(function(a){delete c.current[a];var b=e.contexts[a];b instanceof Array&&b.length&&b.forEach(e.clear)})},this.select=function(b,d){var f=c.current[b];return a.equals(d,f)||(c.current[b]=d,e.clear(b),e.publish(b,d)),d},this.current=function(a){return c.current[a]},this.currentOr=function(b,c){var d=this.current(b);return a.isObject(d)||a.isUndefined(c)?d:c},this.get=e.current,this.getOr=e.currentOr,this.subscribe=function(a,b){return d(function(d,e){c.$on(a,function(a,c){d(b(c||{},a))})})},this.publish=function(a,b){var d=e.contexts[a],f=d?[a].concat(d):[a];return f.forEach(function(a){if(a.constructor!==String)throw"rels must be Strings";c.$broadcast(a,b)}),b}}])}(angular),module&&exports&&module.exports===exports&&(module.exports="ng-current"); |
{ | ||
"name": "ng-current", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "Relational context manager for Angular", | ||
"main": "ng-current.js", | ||
"scripts": { | ||
"test": "npm test" | ||
"test": "npm test", | ||
"ugly": "uglify -s ng-current.js -o ng-current.min.js" | ||
}, | ||
@@ -9,0 +10,0 @@ "repository": { |
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
26885
469