Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Support for {{binding.events.via.a.path}} #30

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nevir
Copy link
Contributor

@nevir nevir commented May 28, 2014

Primarily, this allows for JS-less event wireup, such as:

<polymer-element name="x-foo">
  <template>
    <core-overlay id="overlay"></core-overlay>
    <button id="button" on-tap="{{$.overlay.toggle}}"></button>
  </template>
</polymer-element>

Also, I snuck in a warning (when logging is on) to help diagnose when method dispatch fails to resolve

Primarily, this allows for JS-less event wireup, such as:

```html
<polymer-element name="x-foo">
  <template>
    <core-overlay id="overlay"></core-overlay>
    <button id="button" on-tap="{{$.overlay.toggle}}"></button>
  </template>
</polymer-element>
```
@nevir
Copy link
Contributor Author

nevir commented May 28, 2014

Doh, I totally missed #19 & associated commit - but I think this satisfies it?

@sjmiles
Copy link
Contributor

sjmiles commented May 28, 2014

This is more of a conceptual issue at the moment than a code issue; iow, there is some debate over the proper syntax and layering for event mapping.

Wrt to this particular patch, there are already functions that do efficient object-path resolution, so we probably do not want to re-implement that in dispatchMethod without a solid rationale.

@nevir
Copy link
Contributor Author

nevir commented May 28, 2014

Makes sense on the conceptual front; definitely a bit awkward as-is.

Re: the object/path resolution helper - I poked around the polymer repo for a while, but was unable to find any. Have any tips on where they might be hiding?

I guess what I really want is a variant of Path#getValueFrom that also returns the implied receiver (e.g. whatever object the second to last path component resolves into) - or just handles the method dispatch for me.

Maybe a MemberMethodPath (or whatever name) specialization is a good route? Or another method on Path.

@nevir nevir added cla: yes and removed cla: no labels May 29, 2014
@sorvell
Copy link
Contributor

sorvell commented Aug 12, 2014

I also want to support this:

<button id="button" on-tap="{{$.overlay.toggle}}"></button>

but I think our approach needs to be a bit deeper since I think it'd also be good to support this at the same time:

<template repeat="{{user in users}}">
  <button id="button" on-tap="{{user.add}}">Add</button>
  ...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants