refactor(change_detection): introduce enum ChangeDetectionStrategy

BREAKING CHANGE

Closes #2497

- change detection strategy type changes from string to ChangeDetectionStrategy
- CHECK_ONCE => ChangeDetectionStrategy.CheckOnce
- CHECKED => ChangeDetectionStrategy.Checked
- CHECK_ALWAYS => ChangeDetectionStrategy.CheckAlways
- DETACHED => ChangeDetectionStrategy.Detached
- ON_PUSH => ChangeDetectionStrategy.OnPush
- DEFAULT => ChangeDetectionStrategy.Default
- ON_PUSH_OBSERVE => ChangeDetectionStrategy.OnPushObserve
This commit is contained in:
Misko Hevery
2015-08-26 11:44:59 -07:00
parent e41d7451bf
commit 69926dd002
35 changed files with 388 additions and 365 deletions

View File

@ -5,7 +5,7 @@ import "package:angular2/src/core/facade/collection.dart"
import "common.dart"
show Company, Opportunity, Offering, Account, CustomDate, STATUS_LIST;
import "package:angular2/directives.dart" show NgFor;
import "package:angular2/angular2.dart" show Component, Directive, View;
import "package:angular2/angular2.dart" show Component, Directive, View, ChangeDetectionStrategy;
class HasStyle {
int cellWidth;
@ -17,7 +17,7 @@ class HasStyle {
@Component(
selector: "company-name",
properties: const ["width: cell-width", "company"],
changeDetection: "ON_PUSH_OBSERVE"
changeDetection: ChangeDetectionStrategy.OnPushObserve
)
@View(
directives: const [],
@ -29,7 +29,7 @@ class CompanyNameComponent extends HasStyle {
@Component(
selector: "opportunity-name",
properties: const ["width: cell-width", "opportunity"],
changeDetection: "ON_PUSH_OBSERVE"
changeDetection: ChangeDetectionStrategy.OnPushObserve
)
@View(
directives: const [],
@ -41,7 +41,7 @@ class OpportunityNameComponent extends HasStyle {
@Component(
selector: "offering-name",
properties: const ["width: cell-width", "offering"],
changeDetection: "ON_PUSH_OBSERVE"
changeDetection: ChangeDetectionStrategy.OnPushObserve
)
@View(
directives: const [],
@ -59,7 +59,7 @@ class Stage {
@Component(
selector: "stage-buttons",
properties: const ["width: cell-width", "offering"],
changeDetection: "ON_PUSH_OBSERVE"
changeDetection: ChangeDetectionStrategy.OnPushObserve
)
@View(directives: const [NgFor], template: '''
<div [style.width.px]="cellWidth">
@ -103,7 +103,7 @@ class StageButtonsComponent extends HasStyle {
@Component(
selector: "account-cell",
properties: const ["width: cell-width", "account"],
changeDetection: "ON_PUSH_OBSERVE"
changeDetection: ChangeDetectionStrategy.OnPushObserve
)
@View(directives: const [], template: '''
<div [style.width.px]="cellWidth">
@ -117,7 +117,7 @@ class AccountCellComponent extends HasStyle {
@Component(
selector: "formatted-cell",
properties: const ["width: cell-width", "value"],
changeDetection: "ON_PUSH_OBSERVE"
changeDetection: ChangeDetectionStrategy.OnPushObserve
)
@View(
directives: const [],

View File

@ -2,7 +2,7 @@ library benchmarks.src.naive_infinite_scroll.scroll_area;
import "package:angular2/src/core/facade/collection.dart" show ListWrapper;
import "package:angular2/src/core/facade/math.dart" show Math;
import "package:angular2/angular2.dart" show Component, Directive, View;
import "package:angular2/angular2.dart" show Component, Directive, View, ChangeDetectionStrategy;
import "common.dart"
show
Offering,
@ -16,7 +16,7 @@ import "random_data.dart" show generateOfferings;
import "scroll_item.dart" show ScrollItemComponent;
import "package:angular2/directives.dart" show NgFor;
@Component(selector: "scroll-area", changeDetection: "ON_PUSH_OBSERVE")
@Component(selector: "scroll-area", changeDetection: ChangeDetectionStrategy.OnPushObserve)
@View(directives: const [ScrollItemComponent, NgFor], template: '''
<div>
<div id="scrollDiv"

View File

@ -8,7 +8,7 @@ import "cells.dart"
StageButtonsComponent,
AccountCellComponent,
FormattedCellComponent;
import "package:angular2/angular2.dart" show Component, Directive, View;
import "package:angular2/angular2.dart" show Component, Directive, View, ChangeDetectionStrategy;
import "common.dart"
show
Offering,
@ -25,7 +25,8 @@ import "common.dart"
END_DATE_WIDTH,
AAT_STATUS_WIDTH;
@Component(selector: "scroll-item", properties: const ["offering"], changeDetection: "ON_PUSH_OBSERVE")
@Component(selector: "scroll-item", properties: const ["offering"],
changeDetection: ChangeDetectionStrategy.OnPushObserve)
@View(
directives: const [
CompanyNameComponent,