Skip to content

Commit e362a8f

Browse files
committed
Use custom element on workspace-element
document.registerElement is being deprecated which will make upgrading to later versions of electron imposible
1 parent fea4991 commit e362a8f

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

src/workspace-element.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ const scrollbarStyle = require('scrollbar-style');
88
const _ = require('underscore-plus');
99

1010
class WorkspaceElement extends HTMLElement {
11-
attachedCallback() {
11+
connectedCallback() {
1212
this.focus();
1313
this.htmlElement = document.querySelector('html');
1414
this.htmlElement.addEventListener('mouseleave', this.handleCenterLeave);
1515
}
1616

17-
detachedCallback() {
17+
disconnectedCallback() {
1818
this.subscriptions.dispose();
1919
this.htmlElement.removeEventListener('mouseleave', this.handleCenterLeave);
2020
}
@@ -466,10 +466,6 @@ class WorkspaceElement extends HTMLElement {
466466
}
467467
}
468468

469-
module.exports = document.registerElement('atom-workspace', {
470-
prototype: WorkspaceElement.prototype
471-
});
472-
473469
function isTab(element) {
474470
let el = element;
475471
while (el != null) {
@@ -478,3 +474,13 @@ function isTab(element) {
478474
}
479475
return false;
480476
}
477+
478+
window.customElements.define('atom-workspace', WorkspaceElement);
479+
480+
function createWorkspaceElement() {
481+
return document.createElement('atom-workspace');
482+
}
483+
484+
module.exports = {
485+
createWorkspaceElement
486+
};

src/workspace.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const Panel = require('./panel');
1515
const PanelContainer = require('./panel-container');
1616
const Task = require('./task');
1717
const WorkspaceCenter = require('./workspace-center');
18-
const WorkspaceElement = require('./workspace-element');
18+
const { createWorkspaceElement } = require('./workspace-element');
1919

2020
const STOPPED_CHANGING_ACTIVE_PANE_ITEM_DELAY = 100;
2121
const ALL_LOCATIONS = ['center', 'left', 'right', 'bottom'];
@@ -267,7 +267,7 @@ module.exports = class Workspace extends Model {
267267

268268
getElement() {
269269
if (!this.element) {
270-
this.element = new WorkspaceElement().initialize(this, {
270+
this.element = createWorkspaceElement().initialize(this, {
271271
config: this.config,
272272
project: this.project,
273273
viewRegistry: this.viewRegistry,

0 commit comments

Comments
 (0)