Skip to content

Commit

Permalink
Internal renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
lahmatiy committed Aug 7, 2024
1 parent 86390c9 commit 4d0a110
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/core/utils/container-styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { InitValue, resolveDarkmodeValue } from '../darkmode.js';

type Styles = Record<string, string>;
type SavedStyles = Record<string, [string, string]>;
type Config = {
type ApplyContainerStylesOptions = {
darkmode?: InitValue,
darkmodePersistent?: boolean;
};
Expand Down Expand Up @@ -35,14 +35,14 @@ function saveContainerStyleProp(container: HTMLElement, prop: string, styles: Sa
}
}

export function applyContainerStyles(container: HTMLElement, config: Config) {
config = config || {};
export function applyContainerStyles(container: HTMLElement, options: ApplyContainerStylesOptions) {
options = options || {};

if (!containerBeforeSetStyle.has(container)) {
containerBeforeSetStyle.set(container, Object.create(null));
}

const darkmode = resolveDarkmodeValue(config.darkmode, config.darkmodePersistent);
const darkmode = resolveDarkmodeValue(options.darkmode, options.darkmodePersistent);
const containerStyles = containerBeforeSetStyle.get(container) ?? {};

for (const [prop, value] of Object.entries(styles)) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ export class Model<

encodings: Encoding[];
datasets: ModelDataset[];
#currentSetData: Symbol | undefined;
data: any;
context: any;
prepare: PrepareFunction;
#legacyPrepare: boolean;
#lastSetData: Symbol | undefined;

constructor(options?: Partial<Options>) {
super();
Expand Down Expand Up @@ -230,12 +230,12 @@ export class Model<

// mark as last setData promise
const setDataMarker = Symbol();
this.#currentSetData = setDataMarker;
this.#lastSetData = setDataMarker;

const startTime = Date.now();
const checkIsNotPrevented = () => {
// prevent race conditions, perform only if this promise is last one
if (this.#currentSetData !== setDataMarker) {
if (this.#lastSetData !== setDataMarker) {
throw new Error('Prevented by another setData()');
}
};
Expand Down

0 comments on commit 4d0a110

Please sign in to comment.