diff --git a/rpg-docs/client/lib/bindProperty.js b/rpg-docs/client/lib/bindProperty.js new file mode 100644 index 00000000..b2de2e00 --- /dev/null +++ b/rpg-docs/client/lib/bindProperty.js @@ -0,0 +1,24 @@ +/** + * Take in a map like this: + * { + * "#someId": { + * proprty1() { return someReactiveValue()} + * } + * } + * and bind the properties to the DOM on autorun. + * + * Useful for polymer components where you need to set the order of property updating + * or alter properties that don't bind well to their attributes + */ +Blaze.Template.prototype.binding = function(bindingMap){ + this.onRendered(function(){ + _.each(bindingMap, (propertyMap, cssPattern) => { + node = this.find(cssPattern); + _.each(propertyMap, (func, property) => { + this.autorun(() => { + node[property] = func && func.call && func.call(this, node); + }); + }); + }); + }); +}; diff --git a/rpg-docs/client/views/character/stats/healthCard/healthCard.html b/rpg-docs/client/views/character/stats/healthCard/healthCard.html index 3309c710..95421510 100644 --- a/rpg-docs/client/views/character/stats/healthCard/healthCard.html +++ b/rpg-docs/client/views/character/stats/healthCard/healthCard.html @@ -13,8 +13,6 @@