Files
gerrit/polygerrit-ui/app/samples/bind-parameters.html
brohlfs 3e7f5fdd3f Polymer 2: Add _legacyUndefinedCheck
When legacy-data-mixin.html is imported this will tell you on the console which observers need fixing regarding this change of behavior:

https://polymer-library.polymer-project.org/2.0/docs/upgrade#update-observers

This change was created by running this command line:

find polygerrit-ui/app/ -type f | xargs sed -i '/^    is: / a\    _legacyUndefinedCheck: true,'

Once all observers are fixed, this change will be reverted. This is tracked in https://bugs.chromium.org/p/gerrit/issues/detail?id=10723

Change-Id: Icccdfaa52bf77dfb25e949b2aa2402110f6c2276
2019-04-17 13:15:50 +00:00

39 lines
1.0 KiB
HTML

<dom-module id="bind-parameters">
<script>
Gerrit.install(plugin => {
plugin.registerCustomComponent(
'change-view-integration', 'my-bind-sample');
});
</script>
</dom-module>
<dom-module id="my-bind-sample">
<template>
Template example: Patchset number [[revision._number]]. <br/>
Computed example: [[computedExample]].
</template>
<script>
Polymer({
is: 'my-bind-sample',
_legacyUndefinedCheck: true,
properties: {
computedExample: {
type: String,
computed: '_computeExample(revision._number)',
},
},
attached() {
this.plugin.attributeHelper(this).bind(
'revision', this._onRevisionChanged.bind(this));
},
_computeExample(value) {
if (!value) { return '(empty)'; }
return `(patchset ${value} selected)`;
},
_onRevisionChanged(value) {
console.log(`(attributeHelper.bind) revision number: ${value._number}`);
},
});
</script>
</dom-module>