Files
gerrit/polygerrit-ui/app/samples/bind-parameters.html
Tao Zhou ab57ce3744 Add more jsdoc for closure checks
1. add `@extends` for all polymer elements
2. add `@override` for all lifecycle methods
3. fix a wrong type in gr-auth

Change-Id: Id9dea76b169197084d2e0b5f267459cdc4aaec3e
2020-01-12 16:06:58 +01:00

40 lines
1023 B
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',
properties: {
computedExample: {
type: String,
computed: '_computeExample(revision._number)',
},
},
/** @override */
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>