luisvinicius167 / ityped

Dead simple Javascript animated typing, with no dependencies.
https://ityped.surge.sh/
MIT License
2.33k stars 128 forks source link

Rewrite iTyped #7

Closed felipe-campos closed 7 years ago

felipe-campos commented 7 years ago

there you have it. I’ll copy the same considerations from PR #6 for documentation purposes.

Some of the changes

No async forEach

Used just plain old JavaScript timers to manage asynchronous behaviour.

Use ES6 features to handle parameters

Used default values and simulated named parameters.

Configure optional cursor with only one intuitively-called cursor parameter

By default, iTyped shows a cursor with the character |. You can customize the character or disable the cursor by passing cursor: "" or cursor: false.

Use document.getElementById

I think it was misleading to use document.querySelector. The user should use an id anyway. Unless they want to use iTyped in several elements at the same time, targeting them by class or tag, but, even then, it wouldn’t have worked because we weren’t using querySelectAll.

If the user is going to be bored, it’s better they know in advance what they have to tweak instead of having to find where the bug is.

luisvinicius167 commented 7 years ago

@felipe-campos merged! ;) I will just change some things to maintain the same api.