-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathwebcomponent.js
More file actions
60 lines (43 loc) · 1.77 KB
/
Copy pathwebcomponent.js
File metadata and controls
60 lines (43 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
(function() {
let tmpl = document.createElement('template');
tmpl.innerHTML = `
<style>
</style>
`;
customElements.define('com-sap-sample-template', class WidgetTemplate extends HTMLElement {
constructor() {
super();
let shadowRoot = this.attachShadow({mode: "open"});
shadowRoot.appendChild(tmpl.content.cloneNode(true));
}
//Fired when the widget is added to the html DOM of the page
connectedCallback(){
this._firstConnection = true;
this.redraw();
}
//Fired when the widget is removed from the html DOM of the page (e.g. by hide)
disconnectedCallback(){
}
//When the custom widget is updated, the Custom Widget SDK framework executes this function first
onCustomWidgetBeforeUpdate(oChangedProperties) {
}
//When the custom widget is updated, the Custom Widget SDK framework executes this function after the update
onCustomWidgetAfterUpdate(oChangedProperties) {
if (this._firstConnection){
this.redraw();
}
}
//When the custom widget is removed from the canvas or the analytic application is closed
onCustomWidgetDestroy(){
}
//When the custom widget is resized on the canvas, the Custom Widget SDK framework executes the following JavaScript function call on the custom widget
// Commented out by default. If it is enabled, SAP Analytics Cloud will track DOM size changes and call this callback as needed
// If you don't need to react to resizes, you can save CPU by leaving it uncommented.
/*
onCustomWidgetResize(width, height){
}
*/
redraw(){
}
});
})();