Chromium Code Reviews| Index: pkg/mdv/lib/src/node.dart |
| diff --git a/pkg/mdv/lib/src/node.dart b/pkg/mdv/lib/src/node.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..879b2f787383a07459b278231aea8e6337744c5f |
| --- /dev/null |
| +++ b/pkg/mdv/lib/src/node.dart |
| @@ -0,0 +1,35 @@ |
| +// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| +// for details. All rights reserved. Use of this source code is governed by a |
| +// BSD-style license that can be found in the LICENSE file. |
| + |
| +part of mdv; |
| + |
| +/** Extensions to the [Node] API. */ |
| +class _NodeExtension { |
| + final Node node; |
| + |
| + _NodeExtension(this.node); |
| + |
| + /** |
| + * Binds the attribute [name] to the [path] of the [model]. |
| + * Path is a String of accessors such as `foo.bar.baz`. |
| + */ |
| + void bind(String name, model, String path) { |
| + // TODO(jmesserly): should we throw instead? |
|
justinfagnani
2013/06/25 23:03:31
I don't think so
Jennifer Messerly
2013/06/26 23:09:12
thanks, removed TODO
|
| + window.console.error('Unhandled binding to Node: ' |
| + '$this $name $model $path'); |
| + } |
| + |
| + /** Unbinds the attribute [name]. */ |
| + void unbind(String name) {} |
| + |
| + /** Unbinds all bound attributes. */ |
| + void unbindAll() {} |
| + |
| + TemplateInstance _templateInstance; |
| + |
| + /** Gets the template instance that instantiated this node, if any. */ |
| + TemplateInstance get templateInstance => |
| + _templateInstance != null ? _templateInstance : |
| + (node.parent != null ? node.parent.templateInstance : null); |
| +} |