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

@cerebral/angularjs

Package Overview
Dependencies
Maintainers
5
Versions
270
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cerebral/angularjs - npm Package Compare versions

Comparing version 3.2.0-1519462375777 to 3.2.0-1521141520686

54

lib/module.js

@@ -21,2 +21,3 @@ 'use strict';

this.scope = scope;
this.props = {}; // Holds non-changed props from $onChanges
this.onUpdate = this.onUpdate.bind(this);

@@ -39,2 +40,3 @@ this.ctrl.$onInit = function () {

delete _this.scope;
delete _this.props;
};

@@ -47,12 +49,13 @@ _this.ctrl.$onChanges = function (changesObj) {

return updates;
}, { oldProps: {}, nextProps: {} }),
}, {
oldProps: Object.assign({}, _this.props),
nextProps: Object.assign({}, _this.props)
}),
oldProps = _Object$keys$reduce.oldProps,
nextProps = _Object$keys$reduce.nextProps;
var hasUpdate = _this.view.onPropsUpdate(oldProps, nextProps);
if (hasUpdate) {
Object.assign(_this.ctrl, _this.view.getProps(nextProps, false));
_this.scope.safeApply();
}
_this.view.onPropsUpdate(oldProps, nextProps);
Object.assign(_this.props, nextProps);
Object.assign(_this.ctrl, _this.view.getProps(nextProps, false));
_this.scope.safeApply();
};

@@ -87,5 +90,7 @@ _this.scope.safeApply = function (fn) {

angular.module('cerebral', []).provider('cerebral', function () {
var root = null;
var config = null;
this.configure = function (controllerConfig) {
this.configure = function (rootModule, controllerConfig) {
root = rootModule;
config = controllerConfig;

@@ -95,7 +100,32 @@ };

this.$get = ['$injector', function ($injector) {
config.providers = (config.providers || []).concat((config.services || []).map(function (service) {
return (0, _cerebral.provide)(service, $injector.get(service));
}));
var controller = new _cerebral.Controller(config);
if (root.moduleDescription.hasOwnProperty('services')) {
root.moduleDescription.providers = root.moduleDescription.providers || {};
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = root.moduleDescription.services[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var service = _step.value;
root.moduleDescription.providers[service] = $injector.get(service);
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
}
var controller = new _cerebral.Controller(root, config);
return {

@@ -102,0 +132,0 @@ connect: function connect(ctrl, scope, dependencies, displayName) {

{
"name": "@cerebral/angularjs",
"version": "3.2.0-1519462375777",
"version": "3.2.0-1521141520686",
"description": "Angularjs view for Cerebral",

@@ -17,3 +17,3 @@ "main": "index.js",

"dependencies": {
"cerebral": "^4.2.0-1519462375777"
"cerebral": "^4.2.0-1521141520687"
},

@@ -20,0 +20,0 @@ "scripts": {

@@ -13,2 +13,3 @@ # @cerebral/angularjs

import {addModule, connect} from '@cerebral/angularjs'
import {Controller} from 'cerebral'
import {state, signal} from 'cerebral/tags'

@@ -18,16 +19,17 @@

const rootModule = Module({
state: {
foo: 'bar'
},
signals: {
clicked: []
},
services: ['MyAngularService'] // Root module only. Added as providers with same name
})
const controller = Controller()
angular.module('app', ['cerebral'])
.config(function (cerebralProvider) {
cerebralProvider.configure({
state: {
foo: 'bar'
},
signals: {
clicked: []
},
// Special controller property to expose core
// angular services to your signals
services: ['$http', '$timeout']
})
cerebralProvider.configure(controller)
})

@@ -34,0 +36,0 @@ ...

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