Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return new DisposableDelegate(() => {
// Remove the binding from the array.
ArrayExt.removeFirstOf(this._keyBindings, binding);
// Emit the `bindingChanged` signal.
this._keyBindingChanged.emit({ binding, type: 'removed' });
});
}
private _resolve(button: Dialog.IButton): void {
// Prevent loopback.
const promise = this._promise;
if (!promise) {
this.dispose();
return;
}
this._promise = null;
ArrayExt.removeFirstOf(Private.launchQueue, promise.promise);
let body = this._body;
let value: T | null = null;
if (
button.accept &&
body instanceof Widget &&
typeof body.getValue === 'function'
) {
value = body.getValue();
}
this.dispose();
promise.resolve({ button, value });
}
if (this._root === tabNode) {
this._root = null;
return;
}
// Otherwise, remove the tab node from its parent...
// Prevent widget resizing unless needed.
this._root.holdAllSizes();
// Clear the parent reference on the tab node.
let splitNode = tabNode.parent!;
tabNode.parent = null;
// Remove the tab node from its parent split node.
let i = ArrayExt.removeFirstOf(splitNode.children, tabNode);
let handle = ArrayExt.removeAt(splitNode.handles, i)!;
ArrayExt.removeAt(splitNode.sizers, i);
// Remove the handle from its parent DOM node.
if (handle.parentNode) {
handle.parentNode.removeChild(handle);
}
// If there are multiple children, just update the handles.
if (splitNode.children.length > 1) {
splitNode.syncHandles();
return;
}
// Otherwise, the split node also needs to be removed...
remove(widget: T): void {
// Bail early if the widget is not tracked.
if (!this._numbers.has(widget)) {
return;
}
// Disconnect the disposed signal handler.
widget.disposed.disconnect(this._onWidgetDisposed, this);
// Remove the event listeners.
widget.node.removeEventListener('focus', this, true);
widget.node.removeEventListener('blur', this, true);
// Remove the widget from the internal data structures.
ArrayExt.removeFirstOf(this._widgets, widget);
this._nodes.delete(widget.node);
this._numbers.delete(widget);
// Bail early if the widget is not the current widget.
if (this._currentWidget !== widget) {
return;
}
// Filter the widgets for those which have had focus.
let valid = filter(this._widgets, w => this._numbers.get(w) !== -1);
// Get the valid widget with the max focus number.
let previous = max(valid, (first, second) => {
let a = this._numbers.get(first)!;
let b = this._numbers.get(second)!;
return a - b;
return new DisposableDelegate(() => {
ArrayExt.removeFirstOf(this._fileTypes, value);
this._changed.emit({
type: 'fileType',
name: fileType.name,
change: 'removed'
});
});
}
delete this._widgetFactories[name];
if (this._defaultWidgetFactory === name) {
this._defaultWidgetFactory = '';
}
for (let ext of Object.keys(this._defaultWidgetFactories)) {
if (this._defaultWidgetFactories[ext] === name) {
delete this._defaultWidgetFactories[ext];
}
}
for (let ext of Object.keys(this._defaultRenderedWidgetFactories)) {
if (this._defaultRenderedWidgetFactories[ext] === name) {
delete this._defaultRenderedWidgetFactories[ext];
}
}
for (let ext of Object.keys(this._widgetFactoriesForFileType)) {
ArrayExt.removeFirstOf(this._widgetFactoriesForFileType[ext], name);
if (this._widgetFactoriesForFileType[ext].length === 0) {
delete this._widgetFactoriesForFileType[ext];
}
}
for (let ext of Object.keys(this._defaultWidgetFactoryOverrides)) {
if (this._defaultWidgetFactoryOverrides[ext] === name) {
delete this._defaultWidgetFactoryOverrides[ext];
}
}
this._changed.emit({
type: 'widgetFactory',
name,
change: 'removed'
});
});
}
return new DisposableDelegate(() => {
ArrayExt.removeFirstOf(this._items, item);
});
}
dispose(): void {
const promise = this._promise;
if (promise) {
this._promise = null;
promise.reject(void 0);
ArrayExt.removeFirstOf(Private.launchQueue, promise.promise);
}
super.dispose();
}
export function removeRunning(session: DefaultSession): void {
let running = runningSessions.get(session.serverSettings.baseUrl);
if (running) {
ArrayExt.removeFirstOf(running, session);
}
}