.plugins.atlassian-clientside-extensions-demo.3.0.0-m01-5ba70bd-lt2pg0b9.source-code.panel-plugin.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atlassian-clientside-extensions-demo Show documentation
Show all versions of atlassian-clientside-extensions-demo Show documentation
Demonstrates how product developers and plugin developers can make use of the Client-side Extensions APIs.
/* eslint-disable*/
(function () {
function getPanelContent() {
return `
Cool panel
This is some cool content generated with JS
`;
}
function panelPluginFactory(pluginAPI) {
function onClick() {
alert('You clicked a button');
}
return {
type: 'panel',
label: 'Panel with JS',
onAction: function onAction(panelAPI) {
panelAPI
.onMount(function (container) {
var button = document.createElement('button');
button.setAttribute('data-testid', 'panel-plugin-button');
button.innerText = 'Click me!';
button.addEventListener('click', onClick);
container.innerHTML = getPanelContent();
container.appendChild(button);
})
.onUnmount(function (container) {
console.log('removed event listener for button');
// Don't forget to clean-up your code
var button = container.querySelector('button');
button.removeEventListener('click', onClick);
});
},
};
}
require(['@atlassian/clientside-extensions-registry'], function (registry) {
registry.registerExtension('com.atlassian.plugins.atlassian-clientside-extensions-demo:panel-plugin-js', panelPluginFactory, {
location: 'reff.old-web-items-location',
label: 'loading…',
weight: 100,
});
});
})();
© 2015 - 2025 Weber Informatics LLC | Privacy Policy