
Enable plugin extension endpoints to accept and pass parameters to plugin-provided web components. Declare a named parameter: ``` html <gr-endpoint-decorator name="some-endpoint"> <gr-endpoint-param name="someParam" value="[[someParam]]"> </gr-endpoint-param> </gr-endpoint-decorator> ``` Register a component and get the parameter in the plugin: ``` js Gerrit.install(plugin => { plugin.registerCustomComponent( 'some-endpoint', 'my-plugin-element'); }); ``` ``` html <dom-module id="my-plugin-element"> <template></template> <script> Polymer({ is: 'my-plugin-element', attached() { // Receive the parameter passed in from endpoint console.log(this.someParam); }, }); </script> </dom-module> ``` Change-Id: Ie6b2d92107f332c74532e4462898ae0d876c4603
25 lines
758 B
JavaScript
25 lines
758 B
JavaScript
// Copyright (C) 2017 The Android Open Source Project
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
(function() {
|
|
'use strict';
|
|
|
|
Polymer({
|
|
is: 'gr-endpoint-param',
|
|
properties: {
|
|
name: String,
|
|
value: Object,
|
|
},
|
|
});
|
|
})();
|