Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
binrysearch committed Sep 8, 2024
1 parent 83345c7 commit 667d314
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
8 changes: 4 additions & 4 deletions src/packages/hint/hint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class Hint implements Package<HintOptions> {
private readonly _targetElement: HTMLElement;
private _options: HintOptions;
private _activeHintSignal = van.state<number | undefined>(undefined);
private _refreshes = van.state(0);
private _refreshesSignal = van.state(0);

private readonly callbacks: {
hintsAdded?: hintsAddedCallback;
Expand Down Expand Up @@ -118,7 +118,7 @@ export class Hint implements Package<HintOptions> {
* This is an internal method and should not be used outside of the package.
*/
getRefreshesSignal() {
return this._refreshes;
return this._refreshesSignal;
}

/**
Expand Down Expand Up @@ -305,8 +305,8 @@ export class Hint implements Package<HintOptions> {
return this;
}

if (this._refreshes.val !== undefined) {
this._refreshes.val += 1;
if (this._refreshesSignal.val !== undefined) {
this._refreshesSignal.val += 1;
}

return this;
Expand Down
25 changes: 14 additions & 11 deletions src/packages/tour/tour.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import { FloatingElement } from "./components/FloatingElement";
*/
export class Tour implements Package<TourOptions> {
private _steps: TourStep[] = [];
private _currentStep = van.state<number | undefined>(undefined);
private _refreshes = van.state(0);
private _currentStepSignal = van.state<number | undefined>(undefined);
private _refreshesSignal = van.state(0);
private _root: Element | undefined;
private _direction: "forward" | "backward";
private readonly _targetElement: HTMLElement;
Expand Down Expand Up @@ -170,47 +170,50 @@ export class Tour implements Package<TourOptions> {
* This is an internal method and should not be used outside of the package.
*/
getCurrentStepSignal() {
return this._currentStep;
return this._currentStepSignal;
}

/**
* Returns the underlying state of the refreshes
* This is an internal method and should not be used outside of the package.
*/
getRefreshesSignal() {
return this._refreshes;
return this._refreshesSignal;
}

/**
* Get the current step of the tour
*/
getCurrentStep(): number | undefined {
return this._currentStep.val;
return this._currentStepSignal.val;
}

/**
* @deprecated `currentStep()` is deprecated, please use `getCurrentStep()` instead.
*/
currentStep(): number | undefined {
return this._currentStep.val;
return this._currentStepSignal.val;
}

resetCurrentStep() {
this._currentStep.val = undefined;
this._currentStepSignal.val = undefined;
}

/**
* Set the current step of the tour and the direction of the tour
* @param step
*/
setCurrentStep(step: number): this {
if (this._currentStep.val === undefined || step >= this._currentStep.val) {
if (
this._currentStepSignal.val === undefined ||
step >= this._currentStepSignal.val
) {
this._direction = "forward";
} else {
this._direction = "backward";
}

this._currentStep.val = step;
this._currentStepSignal.val = step;
return this;
}

Expand Down Expand Up @@ -471,8 +474,8 @@ export class Tour implements Package<TourOptions> {
return this;
}

if (this._refreshes.val !== undefined) {
this._refreshes.val += 1;
if (this._refreshesSignal.val !== undefined) {
this._refreshesSignal.val += 1;
}

// fetch new steps and recreate the root element
Expand Down

0 comments on commit 667d314

Please sign in to comment.