ng-current
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -38,3 +38,7 @@ ;(function(angular) { | ||
this.models[service.name] = (service.model || noop).bind(service) | ||
service.select = function() { | ||
return self.select.apply(service, [service.name].concat(Array.prototype.slice.call(arguments))) | ||
} | ||
service.refresh = self.refreshing(service) | ||
@@ -41,0 +45,0 @@ service.use = self.using(service) |
@@ -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,f=function(a){return a};this.contexts={},this.models={},c.current={},this.register=function(a){this.contexts[a.name]=a.rels||[],this.models[a.name]=(a.model||f).bind(a),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=c instanceof Function?c.call(a,a):a[c].bind(a),g=a.model||function(a){return a};f instanceof Function?d.when(f.call(a)).then(function(b){e(b instanceof Array?b.map.call(a,g,a):g.call(a,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)}.bind(a)},this.using=function(a){return function(c,d,f){a.$$hasContext?(f||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)}.bind(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,f,g){var h=c.current[b];return(!a.equals(d,h)||f)&&(g&&(d=this.models[b](d)),c.current[b]=d,e.clear(b),e.publish(b,d)),d},this.current=function(a,b){const d=c.current[a];return b===!1?d:this.models[a](d||{})},this.currentOr=function(b,c,d){var e=this.current(b,d);return a.isObject(e)||a.isUndefined(c)?e:c},this.get=e.current,this.getOr=e.currentOr,this.subscribe=function(a,b){c.$on(a,function(a,c){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"); | ||
!function(a){"use strict";var b=a.module("ng-current",[]);b.service("Contexts",["$log","$rootScope","$q",function(b,c,d){var e=this,f=function(a){return a};this.contexts={},this.models={},c.current={},this.register=function(a){this.contexts[a.name]=a.rels||[],this.models[a.name]=(a.model||f).bind(a),a.select=function(){return e.select.apply(a,[a.name].concat(Array.prototype.slice.call(arguments)))},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=c instanceof Function?c.call(a,a):a[c].bind(a),g=a.model||function(a){return a};f instanceof Function?d.when(f.call(a)).then(function(b){e(b instanceof Array?b.map.call(a,g,a):g.call(a,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)}.bind(a)},this.using=function(a){return function(c,d,f){a.$$hasContext?(f||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)}.bind(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,f,g){var h=c.current[b];return(!a.equals(d,h)||f)&&(g&&(d=this.models[b](d)),c.current[b]=d,e.clear(b),e.publish(b,d)),d},this.current=function(a,b){const d=c.current[a];return b===!1?d:this.models[a](d||{})},this.currentOr=function(b,c,d){var e=this.current(b,d);return a.isObject(e)||a.isUndefined(c)?e:c},this.get=e.current,this.getOr=e.currentOr,this.subscribe=function(a,b){c.$on(a,function(a,c){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.11", | ||
"version": "1.0.12", | ||
"description": "Relational context manager for Angular", | ||
@@ -5,0 +5,0 @@ "main": "ng-current.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
30588
484