Chromium Code Reviews| 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; |