Registering 'global' filters

103 views
Skip to first unread message

Martin Kleinschrodt

unread,
Jul 25, 2014, 4:36:34 AM7/25/14
to polym...@googlegroups.com
What's the preferred way of registering 'global' filters alongside the 'built-in' ones? I understand that filters can be added by simply adding them to the prototype of the PolymerExpressions object but that seems a little messy. Are there any plans to add something like a Polymer.registerFilter() function? Also, some documentation on this would be nice. http://www.polymer-project.org/docs/polymer/expressions.html#custom-filters only describes defining custom filters by adding them to the element prototype which in many cases is not the optimal solution.

Eric Bidelman

unread,
Jul 31, 2014, 7:28:11 PM7/31/14
to Martin Kleinschrodt, polymer-dev
Agreed we need some documentation on this. Opened an issue: https://github.com/Polymer/docs/issues/571

FWIW, Addy put together as nice list of filters that add themselves to PolymerExpression: https://github.com/addyosmani/polymer-filters




On Fri, Jul 25, 2014 at 1:36 AM, Martin Kleinschrodt <makl...@googlemail.com> wrote:
What's the preferred way of registering 'global' filters alongside the 'built-in' ones? I understand that filters can be added by simply adding them to the prototype of the PolymerExpressions object but that seems a little messy. Are there any plans to add something like a Polymer.registerFilter() function? Also, some documentation on this would be nice. http://www.polymer-project.org/docs/polymer/expressions.html#custom-filters only describes defining custom filters by adding them to the element prototype which in many cases is not the optimal solution.

Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups "Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to polymer-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/polymer-dev/69a0df72-cba9-490f-9c43-97aa005e1b6d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Martin Kleinschrodt

unread,
Aug 1, 2014, 10:12:22 AM8/1/14
to polym...@googlegroups.com, makl...@googlemail.com
Thanks, Eric!

Scott Miles

unread,
Aug 14, 2014, 4:43:09 PM8/14/14
to Martin Kleinschrodt, polymer-dev
For the record, yesterday Justin pointed out that putting filters directly on the PolymerExpressions prototype is probably a bad idea because of basic scoping issues. 

I'm inclined to elevate some set of filters (Addy's set is a great start) to a canonical set that we can make the default, but going forward we probably want to have some way of selecting libraries of filters into specific elements via some kind of namespace.


Reply all
Reply to author
Forward
0 new messages