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

Commit

Permalink
feat(scope): Expose Scope.watchAST as a public API
Browse files Browse the repository at this point in the history
For #1086
  • Loading branch information
jbdeboer committed Jun 5, 2014
1 parent bb3d79c commit ecd75ce
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/core/scope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,19 @@ class Scope {
AST ast = rootScope._astParser(expression,
formatters: formatters, collection: collection);

return watch = watchAST(ast, fn, canChangeModel: canChangeModel);
}

/**
* Use [watch] to set up change detection on an pre-parsed AST.
*
* * [ast] The pre-parsed AST.
* * [reactionFn]: The function executed when a change is detected.
* * [canChangeModel]: Whether or not the [reactionFn] can change the model.
*/
Watch watchAST(AST ast, ReactionFn reactionFn, {bool canChangeModel: true}) {
WatchGroup group = canChangeModel ? _readWriteGroup : _readOnlyGroup;
return watch = group.watch(ast, fn);
return group.watch(ast, reactionFn);
}
static Map _oneTimeWarnings = {};

Expand Down

0 comments on commit ecd75ce

Please sign in to comment.