Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add funtion support for confirmCancel #2168

Merged
merged 10 commits into from Feb 28, 2023

Conversation

taozhiyu
Copy link
Contributor

@taozhiyu taozhiyu commented Dec 5, 2022

demo

Promise function:

// TypeScript
{
  ...
  confirmCancel: () => {
    return new Promise<boolean>((resolve) => {
      // my dialog component
      dialog
        .open(
          "Are you sure you want to stop the tour?",
          "You can watch it again in setting paddle"
        )
        .then((res: boolean) => {
          resolve(res);
        });
    });
  },
  ...
}

https://github.com/shipshapecode/shepherd/blob/1076b0c37465cb48968b5f7159e08033cceaab20/test/unit/tour.spec.js#L295-L335
Unit tests have been passed.

@taozhiyu
Copy link
Contributor Author

Can anyone help to see if there is really a problem with this pr?

It doesn't seem to pass the 'cognitive complexity' test, but I don't really know how to reduce it any more.

(In fact, I only added one judgement).

src/js/tour.js Outdated Show resolved Hide resolved
taozhiyu and others added 3 commits January 21, 2023 05:08
Co-authored-by: Robert Wagner <rwwagner90@gmail.com>
src/js/tour.js Outdated Show resolved Hide resolved
@taozhiyu
Copy link
Contributor Author

Hi, is there anything else I need to do?

I see that this PR has not been merged, I just don't know if there is anything else that needs to be done.

@RobbieTheWagner RobbieTheWagner merged commit 4f2173c into shepherd-pro:master Feb 28, 2023
@dvopalecky
Copy link

Hello, thank you for this feature. @RobbieTheWagner, when do you plan to release a new version in npm with this update? Thank you

@RobbieTheWagner
Copy link
Member

A new version has been released

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants