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

[TODO] Improve the "repeat" method #35

Open
qodesmith opened this issue Mar 8, 2021 · 0 comments
Open

[TODO] Improve the "repeat" method #35

qodesmith opened this issue Mar 8, 2021 · 0 comments

Comments

@qodesmith
Copy link
Owner

Look at the custom function I suggested in order to get Typer to repeat typing words from an array. While the .forEach portion seems fine, having to first call .line and then .continue seemed a bit verbose. What if we wanted to repeat certain portions of Typer, then repeat others?

In order to simplify things and have a more intuitive API I'm thinking about introducing a repeatStart method that would be used something like this:

typer('.some-class')
  .cursor({block: true})
  .line()

  // Portion 1 to repeat 3 times
  .repeatStart()
  .continue('Hip-Hop')
  .pause(2000)
  .back('all')
  .continue('Truth')
  .pause(2000)
  .back('all')
  .continue('Free Speech')
  .pause(2000)
  .back('all')
  .repeat(3)

  .line()
  // Portion 2 to repeat 3 times...
  .repeatStart()
  /* ...methods here... */
  .repeat(3)

I'm pretty sure that currently it's possible to use repeat in place of repeatStart in the example above and it would work. But that's confusing. Even if repeatStart was a wrapper around repeat, that would improve the API.

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

No branches or pull requests

1 participant