@cerebral/angular
Advanced tools
Comparing version 4.0.0-1521140905511 to 4.0.0-1525724201307
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var cerebral_1 = require("cerebral"); | ||
var assign = function (a, b) { | ||
return Object.keys(b).reduce(function (current, key) { | ||
current[key] = b[key]; | ||
return current; | ||
}, a); | ||
}; | ||
function connect(dependencies) { | ||
@@ -9,6 +15,8 @@ return function (target) { | ||
var _this = this; | ||
this.props = Object.assign({}, this); | ||
this.props = assign({}, this); | ||
this.onUpdate = function (stateChanges, force) { | ||
_this.view.updateFromState(stateChanges, _this.props, force); | ||
Object.assign(_this, _this.view.getProps(_this.props, false)); | ||
_this.view.render(_this.props, function (componentProps) { | ||
assign(_this, componentProps); | ||
}, false); | ||
_this._cdr.detectChanges(); | ||
@@ -31,3 +39,5 @@ }; | ||
if (hasUpdate) { | ||
Object.assign(_this.ctrl, _this.view.getProps(nextProps, false)); | ||
_this.view.render(nextProps, function (componentProps) { | ||
assign(_this, componentProps); | ||
}, false); | ||
_this._cdr.detectChanges(); | ||
@@ -43,6 +53,9 @@ } | ||
target.prototype.ngAfterViewInit = function () { | ||
var _this = this; | ||
if (targetNgAfterViewInit) { | ||
targetNgAfterViewInit.apply(target); | ||
} | ||
Object.assign(this, this.view.getProps(this.props, false)); | ||
this.view.render(this.props, function (componentProps) { | ||
assign(_this, componentProps); | ||
}, false); | ||
this._cdr.detectChanges(); | ||
@@ -49,0 +62,0 @@ }; |
{ | ||
"name": "@cerebral/angular", | ||
"version": "4.0.0-1521140905511", | ||
"version": "4.0.0-1525724201307", | ||
"description": "Angular view for Cerebral", | ||
@@ -17,23 +17,6 @@ "main": "index.js", | ||
"dependencies": { | ||
"cerebral": "^5.0.0-1521140905511" | ||
"cerebral": "^5.0.0-1525724201307" | ||
}, | ||
"devDependencies": { | ||
"@angular/common": "^4.4.0-RC.0", | ||
"@angular/compiler": "^4.4.0-RC.0", | ||
"@angular/core": "^4.3.6", | ||
"@angular/platform-browser": "^4.4.0-RC.0", | ||
"@angular/platform-browser-dynamic": "^4.3.6", | ||
"@types/express": "^4.0.37", | ||
"@types/mocha": "^2.2.47", | ||
"@types/node": "^9.4.0", | ||
"assert": "^1.4.1", | ||
"babel-cli": "^6.24.1", | ||
"babel-plugin-transform-decorators-legacy": "^1.3.4", | ||
"core-js": "^2.5.0", | ||
"express": "^4.15.4", | ||
"ts-node": "^3.3.0", | ||
"zone.js": "^0.8.17" | ||
}, | ||
"scripts": { | ||
"test": "TS_NODE_IGNORE=false mocha --require test/setup.ts --compilers ts:ts-node/register,tsx:ts-node/register --require ts-node/register test/**/*.ts*", | ||
"test": "TS_NODE_IGNORE=false mocha --require test/setup.ts --require ts-node/register test/**/*.ts", | ||
"build": "tsc -p ./src", | ||
@@ -40,0 +23,0 @@ "coverage": "nyc --reporter=lcov --reporter=json npm run test", |
@@ -10,2 +10,3 @@ # @cerebral/angular | ||
## CerebralService | ||
The Cerebral service exposes the Cerebral controller to your application. | ||
@@ -52,8 +53,17 @@ | ||
## connect decorator | ||
The connect decorator connects state and signals to your components. | ||
```ts | ||
import { Component, ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core' | ||
import { | ||
Component, | ||
ChangeDetectionStrategy, | ||
ChangeDetectorRef | ||
} from '@angular/core' | ||
import { signal, state } from 'cerebral/tags' | ||
import { connect, ControllerService, CerebralComponent } from '@cerebral/angular' | ||
import { | ||
connect, | ||
ControllerService, | ||
CerebralComponent | ||
} from '@cerebral/angular' | ||
@@ -60,0 +70,0 @@ @Component({ |
@@ -8,4 +8,5 @@ { | ||
"strict": true, | ||
"lib": [ "es2015" , "es2017", "dom"] | ||
"strictPropertyInitialization": false, | ||
"lib": ["es2015", "es2017", "dom"] | ||
} | ||
} |
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
0
135
91
8590
12