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

ng-current

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ng-current - npm Package Compare versions

Comparing version 1.0.7 to 1.0.8

15

ng-current.js

@@ -83,7 +83,9 @@ ;(function(angular) {

this.using = function(service) {
return function(method, andThen) {
return function(method, andThen, defer) {
// invoke refresh immediately and then ensure that provided
// method is subscribed and refreshed w/ future updates to the service
if (service.$$hasContext) {
service.refresh(method, andThen)
if (!defer) {
service.refresh(method, andThen)
}

@@ -198,11 +200,6 @@ self.subscribe(service.name, function(data) {

* @param {Function} on behavior to invoke on publication
* @returns {Promise}
*/
this.subscribe = function(rel, on) {
return $q(function(resolve, reject) {
$rootScope.$on(rel, function(event, data) {
resolve(
on(data || {}, event)
)
})
$rootScope.$on(rel, function(event, data) {
on(data || {}, event)
})

@@ -209,0 +206,0 @@ }

2

ng-current.min.js

@@ -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.$$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,f){var g=c.current[b];return a.equals(d,g)||(f&&(d=this.contexts[b].model(d)),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");
!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,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)}},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){var g=c.current[b];return a.equals(d,g)||(f&&(d=this.contexts[b].model(d)),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){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.7",
"version": "1.0.8",
"description": "Relational context manager for Angular",

@@ -5,0 +5,0 @@ "main": "ng-current.js",

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