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

Commit 88832c1

Browse files
vicbtravis@travis-ci.org
authored and
travis@travis-ci.org
committed
refactor(element_binder): controller -> directive
1 parent 5b974c4 commit 88832c1

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

lib/core_dom/element_binder.dart

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class ElementBinder {
124124
dstPathFn.assign(controller, _parser(expression).bind(scope.context, ScopeLocals.wrapper));
125125
}
126126

127-
_createAttrMappings(controller, scope, List<MappingParts> mappings, nodeAttrs, formatters, tasks) {
127+
_createAttrMappings(directive, scope, List<MappingParts> mappings, nodeAttrs, formatters, tasks) {
128128
mappings.forEach((MappingParts p) {
129129
var attrName = p.attrName;
130130
var dstExpression = p.dstExpression;
@@ -140,11 +140,11 @@ class ElementBinder {
140140
if (bindAttr != null) {
141141
if (p.mode == '<=>') {
142142
_bindTwoWay(tasks, bindAttr, scope, dstPathFn,
143-
controller, formatters, dstExpression);
143+
directive, formatters, dstExpression);
144144
} else if(p.mode == '&') {
145-
_bindCallback(dstPathFn, controller, bindAttr, scope);
145+
_bindCallback(dstPathFn, directive, bindAttr, scope);
146146
} else {
147-
_bindOneWay(tasks, bindAttr, scope, dstPathFn, controller, formatters);
147+
_bindOneWay(tasks, bindAttr, scope, dstPathFn, directive, formatters);
148148
}
149149
return;
150150
}
@@ -153,7 +153,7 @@ class ElementBinder {
153153
case '@': // string
154154
var taskId = tasks.registerTask();
155155
nodeAttrs.observe(attrName, (value) {
156-
dstPathFn.assign(controller, value);
156+
dstPathFn.assign(directive, value);
157157
tasks.completeTask(taskId);
158158
});
159159
break;
@@ -162,13 +162,13 @@ class ElementBinder {
162162
if (nodeAttrs[attrName] == null) return;
163163

164164
_bindTwoWay(tasks, nodeAttrs[attrName], scope, dstPathFn,
165-
controller, formatters, dstExpression);
165+
directive, formatters, dstExpression);
166166
break;
167167

168168
case '=>': // one-way
169169
if (nodeAttrs[attrName] == null) return;
170170
_bindOneWay(tasks, nodeAttrs[attrName], scope,
171-
dstPathFn, controller, formatters);
171+
dstPathFn, directive, formatters);
172172
break;
173173

174174
case '=>!': // one-way, one-time
@@ -178,7 +178,7 @@ class ElementBinder {
178178
var watch;
179179
var lastOneTimeValue;
180180
watch = scope.watch(nodeAttrs[attrName], (value, _) {
181-
if ((lastOneTimeValue = dstPathFn.assign(controller, value)) != null && watch != null) {
181+
if ((lastOneTimeValue = dstPathFn.assign(directive, value)) != null && watch != null) {
182182
var watchToRemove = watch;
183183
watch = null;
184184
scope.rootScope.domWrite(() {
@@ -193,7 +193,7 @@ class ElementBinder {
193193
break;
194194

195195
case '&': // callback
196-
_bindCallback(dstPathFn, controller, nodeAttrs[attrName], scope);
196+
_bindCallback(dstPathFn, directive, nodeAttrs[attrName], scope);
197197
break;
198198
}
199199
});
@@ -205,24 +205,24 @@ class ElementBinder {
205205
try {
206206
var linkMapTimer;
207207
assert((linkTimer = _perf.startTimer('ng.view.link', ref.type)) != false);
208-
var controller = nodeInjector.get(ref.type);
209-
probe.directives.add(controller);
208+
var directive = nodeInjector.get(ref.type);
209+
probe.directives.add(directive);
210210
assert((linkMapTimer = _perf.startTimer('ng.view.link.map', ref.type)) != false);
211211

212212
if (ref.annotation is Controller) {
213-
scope.context[(ref.annotation as Controller).publishAs] = controller;
213+
scope.context[(ref.annotation as Controller).publishAs] = directive;
214214
}
215215

216-
var tasks = new _TaskList(controller is AttachAware ? () {
217-
if (scope.isAttached) controller.attach();
216+
var tasks = new _TaskList(directive is AttachAware ? () {
217+
if (scope.isAttached) directive.attach();
218218
} : null);
219219

220220
if (ref.mappings.isNotEmpty) {
221221
if (nodeAttrs == null) nodeAttrs = new _AnchorAttrs(ref);
222-
_createAttrMappings(controller, scope, ref.mappings, nodeAttrs, formatters, tasks);
222+
_createAttrMappings(directive, scope, ref.mappings, nodeAttrs, formatters, tasks);
223223
}
224224

225-
if (controller is AttachAware) {
225+
if (directive is AttachAware) {
226226
var taskId = tasks.registerTask();
227227
Watch watch;
228228
watch = scope.watch('1', // Cheat a bit.
@@ -234,8 +234,8 @@ class ElementBinder {
234234

235235
tasks.doneRegistering();
236236

237-
if (controller is DetachAware) {
238-
scope.on(ScopeEvent.DESTROY).listen((_) => controller.detach());
237+
if (directive is DetachAware) {
238+
scope.on(ScopeEvent.DESTROY).listen((_) => directive.detach());
239239
}
240240

241241
assert(_perf.stopTimer(linkMapTimer) != false);

0 commit comments

Comments
 (0)