 6e1e69bcce
			
		
	
	6e1e69bcce
	
	
	
		
			
			Whenever endpoint-provided value changes, update corresponding attribute on the plugin provided element. With this change, plugins can receive updates to the parameters if that's needed. To take advantage of this change, plugin has few options: - use a Polymer observers or computed properties - use `plugin.attributeHelper(element).bind(propertyName, callback)` Bug: Issue 8162 Change-Id: Ie95f30dd8d840be62cb3370bf39de96672638fd7
		
			
				
	
	
		
			38 lines
		
	
	
		
			999 B
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			38 lines
		
	
	
		
			999 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)',
 | |
|         },
 | |
|       },
 | |
|       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>
 |