Files
gerrit/polygerrit-ui/app/elements/plugins/gr-endpoint-param/gr-endpoint-param.html
Viktar Donich e5ec11c0c0 Plugin endpoint parameters
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
2017-10-01 09:06:07 +01:00

22 lines
754 B
HTML

<!--
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.
-->
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<dom-module id="gr-endpoint-param">
<script src="gr-endpoint-param.js"></script>
</dom-module>