Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Renaming the Scope.watch readOnly argument #739

Closed
vicb opened this issue Mar 16, 2014 · 0 comments
Closed

Renaming the Scope.watch readOnly argument #739

vicb opened this issue Mar 16, 2014 · 0 comments

Comments

@vicb
Copy link
Contributor

vicb commented Mar 16, 2014

When adding a watch, there is a readOnlyargument. The effect of setting readOnly to true is that the watch expression will be evaluated in the flush phase rather than the digest phase.

It should be used when the watch could not result in updating the model and lead to better performance as the expression it evaluated only once instead instead multiple time until the digest converges.

We have been discussing with @mhevery about renaming this argument.

Potential candidates:

  • flushPhase
  • canChangeModel

The former describes more the implementation, the latter has my preference.

Thoughts ? Any other proposal ?

vicb added a commit to vicb/angular.dart that referenced this issue Mar 20, 2014
closes dart-archive#739

This changes is a BC break:
- the "readOnly" parameter has been renamed to "canChangeModel",
- the semantic is inversed

Before:

    // Default to digest (readOnly = false by default)
    scope.watch(exp, fn);
	// Explicit flush
    scope.watch(exp, fn, readOnly: true);

After

    // Default to digest (canChangeModel = true by default)
    scope.watch(exp, fn);
	// Explicit flush
    scope.watch(exp, fn, canChangeModel: false);
vicb added a commit to vicb/angular.dart that referenced this issue Mar 31, 2014
closes dart-archive#739

This changes is a BC break:
- the "readOnly" parameter has been renamed to "canChangeModel",
- the semantic is inversed

Before:

    // Default to digest (readOnly = false by default)
    scope.watch(exp, fn);
	// Explicit flush
    scope.watch(exp, fn, readOnly: true);

After

    // Default to digest (canChangeModel = true by default)
    scope.watch(exp, fn);
	// Explicit flush
    scope.watch(exp, fn, canChangeModel: false);

Conflicts:
	example/web/bouncing_balls.dart
	lib/core/scope.dart
	lib/directive/ng_class.dart
	lib/directive/ng_style.dart
vicb added a commit to vicb/angular.dart that referenced this issue Mar 31, 2014
closes dart-archive#739

This changes is a BC break:
- the "readOnly" parameter has been renamed to "canChangeModel",
- the semantic is inversed

Before:

    // Default to digest (readOnly = false by default)
    scope.watch(exp, fn);
    // Explicit flush
    scope.watch(exp, fn, readOnly: true);

After:

    // Default to digest (canChangeModel = true by default)
    scope.watch(exp, fn);
    // Explicit flush
    scope.watch(exp, fn, canChangeModel: false);
vicb added a commit to vicb/angular.dart that referenced this issue Mar 31, 2014
closes dart-archive#739

This changes is a BC break:
- the "readOnly" parameter has been renamed to "canChangeModel",
- the semantic is inversed

Before:

    // Default to digest (readOnly = false by default)
    scope.watch(exp, fn);
    // Explicit flush
    scope.watch(exp, fn, readOnly: true);

After:

    // Default to digest (canChangeModel = true by default)
    scope.watch(exp, fn);
    // Explicit flush
    scope.watch(exp, fn, canChangeModel: false);
@vicb vicb closed this as completed in 1e67cbb Mar 31, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant