New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

angular-es-utils

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-es-utils - npm Package Compare versions

Comparing version 1.2.13 to 1.2.14

64

injector/index.js

@@ -6,4 +6,2 @@ 'use strict';

});
exports.getInjector = getInjector;
exports._assignInjector = _assignInjector;

@@ -22,60 +20,10 @@ var _angular = require('angular');

function ready(fn) {
var bootstrap = _angular2.default.bootstrap;
var fired = false;
// rewrite angular bootstrap method to assign our injector
_angular2.default.bootstrap = function () {
injector = bootstrap.apply(undefined, arguments);
return injector;
};
function trigger() {
if (fired) return;
fired = true;
fn();
}
// check if document is already loaded
if (window.document.readyState === 'complete') {
window.setTimeout(trigger, 0);
} else {
window.addEventListener('DOMContentLoaded', trigger); // works for modern browsers and IE9
// we can not use jqLite since we are not done loading and jQuery could be loaded later.
// jshint -W064
window.addEventListener('load', trigger); // fallback to window.onload for others
// jshint +W064
}
}
/**
* 获取应用的injector,默认查询被ng-app标记的节点,否则从document.body开始找
* @param rootElement
*/
function getInjector() {
var rootElement = arguments.length <= 0 || arguments[0] === undefined ? document.querySelector('[ng-app]') || document.body : arguments[0];
var injector = _angular2.default.element(rootElement).injector();
if (injector) {
return injector;
} else {
var childNodes = rootElement.childNodes;
for (var i = 0; i < childNodes.length; i++) {
var _injector = getInjector(childNodes[i]);
if (_injector) {
return _injector;
}
}
}
return null;
}
// export for testing
function _assignInjector() {
injector = getInjector();
}
ready(_assignInjector);
// make commonjs have the same behavior with es6 module

@@ -82,0 +30,0 @@ Object.defineProperty(exports, 'default', {

13

mediator/index.js

@@ -7,6 +7,2 @@ 'use strict';

var _injector = require('../injector');
var _injector2 = _interopRequireDefault(_injector);
var _angular = require('angular');

@@ -18,3 +14,8 @@

var topics = {};
/**
* 中介者模式。用于解决各模块间无法通过 $scope.$emit $scope.$on 等方式实现通信的问题(例如兄弟模块间通信)
*/
/**
* @author Kuitos

@@ -25,4 +26,2 @@ * @homepage https://github.com/kuitos/

var topics = {};
exports.default = {

@@ -58,3 +57,3 @@

if (scope && scope.constructor === _injector2.default.get('$rootScope').constructor) {
if (scope && scope.constructor === scope.$root.constructor) {
// scope销毁时同步移除对应订阅行为

@@ -61,0 +60,0 @@ scope.$on('$destroy', unSubscribe.bind(null, listener));

{
"name": "angular-es-utils",
"version": "1.2.13",
"version": "1.2.14",
"description": "es utils design for angular1.x",

@@ -5,0 +5,0 @@ "main": "./index.js",

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