Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Templatizer->Templatize & add bc Templatizer behavior #4277

Merged
merged 20 commits into from
Feb 10, 2017

Conversation

kevinpschaaf
Copy link
Member

@kevinpschaaf kevinpschaaf commented Jan 26, 2017

Rename Polymer.Templatizer library to Polymer.Templatize & add pseudo-backwards-compatible Polymer.Templatizer behavior for slightly better hybrid support.

For now, users will need to implement both 1.0 & 2.0 callbacks differently (to e.g. deal with path differences due to removal of Collection, different TemplateInstance API, etc:

Example hybrid element:

Polymer({
  ...
  behaviors: [ Polymer.Templatizer ],
  // 2.0 callback implementation
  _forwardHostPropV2: function(prop, value) { /* use 2.0 API */ },
  _notifyInstancePropV2: function(inst, prop, value) { /* use 2.0 API */ },
  // 1.0 callback implementation
  _forwardInstancePath function(inst, path, value) { /* use 1.0 API */ },
  _forwardInstanceProp function(inst, prop, value) { /* use 1.0 API */ },
  _forwardParentPath: function(path, value) { /* use 1.0 API */ },
  _forwardParentProp: function(prop, value) { /* use 1.0 API */ },
  ...
});

@web-padawan
Copy link
Contributor

@kevinpschaaf could you check these issues please?
#3755 #3307

@kevinpschaaf kevinpschaaf requested a review from blasten January 30, 2017 17:17
let Templatizer = {
templatize(template) {
this._userTemplate = template;
this.ctor = Templatize.templatize(template, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed _ctor toctor since that is how it was defined in v1.

@blasten
Copy link
Contributor

blasten commented Jan 31, 2017

Having the tests (Templatizer related) for iron-list 2.0 in hybrid mode passing, I think the changes LGTM. Thanks!

There are a few remaining issues we can address on separate PRs if necessary:

  1. selectIndex/deselectIndex in array-selector for v1.
  2. Debouncer now has a flush method, but it used to be called complete in v1. It could possibly be fixed in Introduce new API for debouncer and Async #4182
  3. A story around making Introduce new API for debouncer and Async #4182 v1-compatible.

Copy link
Contributor

@sorvell sorvell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

* `templatizer` folder -> data-elements folder
* `templatizer in filenames` -> templatize
* `fwdHostPropToInstance` -> forwardHostProp
* `fwdInstancePropToHost` -> notifyInstanceProp
* behavior `_fwdHostPropToInstance` -> _forwardHostPropV2
* behavior `_ fwdInstancePropToHost` -> _notifyInstancePropV2
* templatize now takes 2nd arg for the binding context of the callbacks
* removed first argument of forwardHostProp callback
* TemplateInstance constructor no longer takes "host" arugment
* TemplateInstance API forwardProperty & flushProperties removed
* TemplateInstance API forwardHostProp added, should be called from forwardHostProp callback
@kevinpschaaf
Copy link
Member Author

kevinpschaaf commented Feb 9, 2017

@blasten We treated this PR as an overall review of the 2.0 Templatizer API, and made the following changes:

  • Renamed callback fwdHostPropToInstance -> forwardHostProp
  • Renamed callback fwdInstancePropToHost -> notifyInstanceProp
  • Renamed behavior callback _fwdHostPropToInstance -> _forwardHostPropV2
  • Renamed behavior callback _fwdInstancePropToHost -> _notifyInstancePropV2
  • templatize now takes 2nd arg for the binding context of the callbacks (normally this of the element calling templatize)
  • removed first argument of forwardHostProp callback, since the function is bound to the 2nd arg of templatize, which is what you want
  • TemplateInstance constructor no longer takes host argument
  • TemplateInstance API forwardProperty & flushProperties removed
  • TemplateInstance API forwardHostProp added, should be called from forwardHostProp callback

Refer to e.g. dom-repeat implementation for usage changes...

@sorvell sorvell merged commit 079bffc into 2.0-preview Feb 10, 2017
@sorvell sorvell deleted the 2.0-templatizer-bc-api branch February 10, 2017 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants