We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
First of all, great library, thank you. I'm wondering if there's a good way to dry up some of my chaining. Say I have something like this:
new TypeIt('#my-el') .type('abc') .move(null, { instant: true }) .type('\n') .move(null, { instant: true }) .type('123') .move(null, { instant: true }) .type('\n') .move(null, { instant: true }) .type('456') .go();
Is it possible to encapsulate the
.move(null, { instant: true }) .type('\n') .move(null, { instant: true })
stuff into its own function somehow?
I know this works:
let t = new TypeIt('#my-el').type('abc'); t = typeAtStart(t, '123'); t = typeAtStart(t, '456'); t.go(); function typeAtStart(typeIt: TypeIt, text: string) { return typeIt .move(null, { instant: true }) .type('\n') .move(null, { instant: true }) .type(text); }
But I'm wondering if there's a more idiomatic way to do it, maybe without having to break up the chain.
I tried doing it like this:
new TypeIt('#$my-el') .type('abc') .exec((t) => typeAtStart(t, '123')) .exec((t) => typeAtStart(t, '456')) .go(); function typeAtStart(typeIt: TypeIt, text: string) { return typeIt .move(null, { instant: true }) .type('\n') .move(null, { instant: true }) .type(text); }
But that doesn't seem to work.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
First of all, great library, thank you. I'm wondering if there's a good way to dry up some of my chaining. Say I have something like this:
Is it possible to encapsulate the
stuff into its own function somehow?
I know this works:
But I'm wondering if there's a more idiomatic way to do it, maybe without having to break up the chain.
I tried doing it like this:
But that doesn't seem to work.
The text was updated successfully, but these errors were encountered: