mirror of
https://github.com/microsoft/vscode.git
synced 2026-08-19 14:22:19 +01:00
Renames IObservableValue to IValueWithChangeEvent to avoid confusion with observables.
`onDidChange` doesn't ship the new value anymore to enable lazy value computation.
This commit is contained in:
committed by
Henning Dieterichs
parent
ef6345ae05
commit
c2f0a3fdf3
@@ -12,7 +12,7 @@ import { SmoothScrollableElement } from 'vs/base/browser/ui/scrollbar/scrollable
|
||||
import { distinct, equals } from 'vs/base/common/arrays';
|
||||
import { Delayer, disposableTimeout } from 'vs/base/common/async';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { Emitter, Event, IValueWithChangeEvent } from 'vs/base/common/event';
|
||||
import { Disposable, DisposableStore, IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { IRange, Range } from 'vs/base/common/range';
|
||||
import { INewScrollDimensions, Scrollable, ScrollbarVisibility, ScrollEvent } from 'vs/base/common/scrollable';
|
||||
@@ -20,7 +20,6 @@ import { ISpliceable } from 'vs/base/common/sequence';
|
||||
import { IListDragAndDrop, IListDragEvent, IListGestureEvent, IListMouseEvent, IListRenderer, IListTouchEvent, IListVirtualDelegate, ListDragOverEffectPosition, ListDragOverEffectType } from 'vs/base/browser/ui/list/list';
|
||||
import { IRangeMap, RangeMap, shift } from 'vs/base/browser/ui/list/rangeMap';
|
||||
import { IRow, RowCache } from 'vs/base/browser/ui/list/rowCache';
|
||||
import { IObservableValue } from 'vs/base/common/observableValue';
|
||||
import { BugIndicatingError } from 'vs/base/common/errors';
|
||||
import { AriaRole } from 'vs/base/browser/ui/aria/aria';
|
||||
import { ScrollableElementChangeOptions } from 'vs/base/browser/ui/scrollbar/scrollableElementOptions';
|
||||
@@ -62,7 +61,7 @@ export interface IListViewAccessibilityProvider<T> {
|
||||
getSetSize?(element: T, index: number, listLength: number): number;
|
||||
getPosInSet?(element: T, index: number): number;
|
||||
getRole?(element: T): AriaRole | undefined;
|
||||
isChecked?(element: T): boolean | IObservableValue<boolean> | undefined;
|
||||
isChecked?(element: T): boolean | IValueWithChangeEvent<boolean> | undefined;
|
||||
}
|
||||
|
||||
export interface IListViewOptionsUpdate {
|
||||
@@ -195,7 +194,7 @@ class ListViewAccessibilityProvider<T> implements Required<IListViewAccessibilit
|
||||
readonly getSetSize: (element: any, index: number, listLength: number) => number;
|
||||
readonly getPosInSet: (element: any, index: number) => number;
|
||||
readonly getRole: (element: T) => AriaRole | undefined;
|
||||
readonly isChecked: (element: T) => boolean | IObservableValue<boolean> | undefined;
|
||||
readonly isChecked: (element: T) => boolean | IValueWithChangeEvent<boolean> | undefined;
|
||||
|
||||
constructor(accessibilityProvider?: IListViewAccessibilityProvider<T>) {
|
||||
if (accessibilityProvider?.getSetSize) {
|
||||
@@ -919,7 +918,7 @@ export class ListView<T> implements IListView<T> {
|
||||
} else if (checked) {
|
||||
const update = (checked: boolean) => item.row!.domNode.setAttribute('aria-checked', String(!!checked));
|
||||
update(checked.value);
|
||||
item.checkedDisposable = checked.onDidChange(update);
|
||||
item.checkedDisposable = checked.onDidChange(() => update(checked.value));
|
||||
}
|
||||
|
||||
if (item.stale || !item.row.domNode.parentElement) {
|
||||
|
||||
@@ -1630,3 +1630,8 @@ export class Relay<T> implements IDisposable {
|
||||
this.emitter.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
export interface IValueWithChangeEvent<T> {
|
||||
readonly onDidChange: Event<void>;
|
||||
readonly value: T;
|
||||
}
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event } from 'vs/base/common/event';
|
||||
//@ts-ignore
|
||||
import type { IObservable } from 'vs/base/common/observable';
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link IObservable} instead.
|
||||
*/
|
||||
export interface IObservableValue<T> {
|
||||
onDidChange: Event<T>;
|
||||
readonly value: T;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user