Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(897)

Unified Diff: packages/template_binding/lib/src/binding_delegate.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: packages/template_binding/lib/src/binding_delegate.dart
diff --git a/packages/template_binding/lib/src/binding_delegate.dart b/packages/template_binding/lib/src/binding_delegate.dart
deleted file mode 100644
index 215c9f34254a92b8cfe2f710afd0847804b05dd1..0000000000000000000000000000000000000000
--- a/packages/template_binding/lib/src/binding_delegate.dart
+++ /dev/null
@@ -1,78 +0,0 @@
-// 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 template_binding;
-
-/**
- * Template Bindings native features enables a wide-range of use cases,
- * but (by design) don't attempt to implement a wide array of specialized
- * behaviors.
- *
- * Enabling these features is a matter of implementing and registering a
- * BindingDelegate. A binding delegate is an object which contains one or more
- * delegation functions which implement specialized behavior. This object is
- * registered via [TemplateBindExtension.bindingDelegate]:
- *
- * HTML:
- * <template bind>
- * {{ What!Ever('crazy')->thing^^^I+Want(data) }}
- * </template>
- *
- * Dart:
- * class MySyntax extends BindingDelegate {
- * prepareBinding(path, name, node) {
- * // The magic happens here!
- * }
- * }
- * ...
- * templateBind(query('template'))
- * ..bindingDelegate = new MySyntax()
- * ..model = new MyModel();
- *
- *
- * See
- * <http://www.polymer-project.org/platform/template.html#binding-delegate-api>
- * for more information about the binding delegate.
- */
-// TODO(jmesserly): need better api docs here. The link above seems out of date.
-class BindingDelegate {
- /**
- * Prepares a binding. This is called immediately after parsing a mustache
- * token with `{{ path }}` in the context of the [node] and the property named
- * [name]. This should return a function that will be passed the actual
- * node and model, and either returns null or an object with a `value`
- * property. This allows the syntax to reinterpret the model for each binding.
- */
- PrepareBindingFunction prepareBinding(String path, String name, Node node)
- => null;
-
- /**
- * Returns a function that can optionally replace the model that will be
- * passed to [TemplateBindExtension.createInstance]. This can be used to
- * implement syntax such as `<template repeat="{{ item in items }}">` by
- * ensuring that the returned model has the "item" name available.
- */
- PrepareInstanceModelFunction prepareInstanceModel(Element template) => null;
-
- /**
- * Returns a function that will be called whenever the position of an item
- * inside this template changes.
- */
- PrepareInstancePositionChangedFunction prepareInstancePositionChanged(
- Element template) => null;
-
- Expando<_InstanceBindingMap> _bindingMaps;
-
- // TODO(jmesserly): if we have use this everywhere, we can avoid many
- // delegate != null checks throughout the code, simplifying things.
- // For now we just use it for _bindingMaps.
- static final _DEFAULT = new BindingDelegate();
-}
-
-typedef PrepareBindingFunction(model, Node node, bool oneTime);
-
-typedef PrepareInstanceModelFunction(model);
-
-typedef PrepareInstancePositionChangedFunction(TemplateInstance instance,
- int index);
« no previous file with comments | « packages/template_binding/lib/js/observe.js ('k') | packages/template_binding/lib/src/instance_binding_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698