Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Commit abd79d2

Browse files
committed
Use custom element on pane resize-handle element
1 parent 5723092 commit abd79d2

2 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/pane-axis-element.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
const { CompositeDisposable } = require('event-kit');
2-
/* eslint-disable-next-line no-unused-vars */
3-
const PaneResizeHandleElement = require('./pane-resize-handle-element');
2+
require('./pane-resize-handle-element');
43

54
class PaneAxisElement extends HTMLElement {
65
connectedCallback() {

src/pane-resize-handle-element.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class PaneResizeHandleElement extends HTMLElement {
2-
createdCallback() {
2+
constructor() {
3+
super()
34
this.resizePane = this.resizePane.bind(this);
45
this.resizeStopped = this.resizeStopped.bind(this);
56
this.subscribeToDOMEvents();
@@ -10,7 +11,7 @@ class PaneResizeHandleElement extends HTMLElement {
1011
this.addEventListener('mousedown', this.resizeStarted.bind(this));
1112
}
1213

13-
attachedCallback() {
14+
connectedCallback() {
1415
// For some reason Chromium 58 is firing the attached callback after the
1516
// element has been detached, so we ignore the callback when a parent element
1617
// can't be found.
@@ -20,7 +21,7 @@ class PaneResizeHandleElement extends HTMLElement {
2021
}
2122
}
2223

23-
detachedCallback() {
24+
disconnectedCallback() {
2425
this.resizeStopped();
2526
}
2627

@@ -105,6 +106,15 @@ class PaneResizeHandleElement extends HTMLElement {
105106
}
106107
}
107108

108-
module.exports = document.registerElement('atom-pane-resize-handle', {
109-
prototype: PaneResizeHandleElement.prototype
110-
});
109+
window.customElements.define(
110+
'atom-pane-resize-handle',
111+
PaneResizeHandleElement
112+
);
113+
114+
function createPaneResizeHandleElement() {
115+
return document.createElement('atom-pane-resize-handle');
116+
}
117+
118+
module.exports = {
119+
createPaneResizeHandleElement
120+
};

0 commit comments

Comments
 (0)