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

Unified Diff: pkg/polymer/lib/src/instance.dart

Issue 340693002: eventController interop with polymer.js (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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
« no previous file with comments | « no previous file | pkg/polymer/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/polymer/lib/src/instance.dart
diff --git a/pkg/polymer/lib/src/instance.dart b/pkg/polymer/lib/src/instance.dart
index 7838acaf525a51455ae44c376fc61283102b89f6..1c1f7299de9779d4a71361647f27ed023d920399 100644
--- a/pkg/polymer/lib/src/instance.dart
+++ b/pkg/polymer/lib/src/instance.dart
@@ -182,12 +182,16 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
CompoundObserver _propertyObserver;
bool _readied = false;
+ JsObject _jsElem;
+
/// Returns the object that should be used as the event controller for
/// event bindings in this element's template. If set, this will override the
/// normal controller lookup.
- // TODO(jmesserly): type seems wrong here? I'm guessing this should be any
- // kind of model object. Also, should it be writable by anyone?
- Polymer eventController;
+ // TODO(jmesserly): we need to use a JS-writable property as our backing
+ // store, because of elements such as:
+ // https://github.com/Polymer/core-overlay/blob/eeb14853/core-overlay-layer.html#L78
+ get eventController => _jsElem['eventController'];
+ set eventController(value) { _jsElem['eventController'] = value; }
Siggi Cherem (dart-lang) 2014/06/18 01:51:42 woah! Should we add the type annotation here? Mai
Jennifer Messerly 2014/06/18 02:18:47 Hmmm. We could put back Element, which is what Pol
bool get hasBeenAttached => _hasBeenAttached;
bool _hasBeenAttached = false;
@@ -263,6 +267,7 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
window.console.warn('Element already prepared: $_name');
return;
}
+ _initJsObject();
// Dart note: get the corresponding <polymer-element> declaration.
_element = _getDeclaration(_name);
// install property storage
@@ -277,6 +282,12 @@ abstract class Polymer implements Element, Observable, NodeBindExtension {
addHostListeners();
}
+ /// Initialize JS interop for this element. For now we just initialize the
+ // JsObject, but in the future we could also initialize JS APIs here.
+ _initJsObject() {
+ _jsElem = new JsObject.fromBrowserObject(this);
+ }
+
makeElementReady() {
if (_readied) return;
_readied = true;
« no previous file with comments | « no previous file | pkg/polymer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698