npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

typerbot

v0.1.7

Published

Flexible library for programmatic typing.

Downloads

10

Readme

Typerbot :robot:

What is Typerbot?

Typerbot is a flexible library designed to mimic keyboard input into any DOM Element. Built on Async/Await , Typerbot provides an intuitive API to let developers focus on unleashing their creativity instead of getting lost in the weeds.

Features

  • Typerbot can mimic any input from a keyboard, allowing users to move their cursor, delete characters, and enter new characters into a provided field element.
  • Use handy utility functions to expedite your development process and write code in a more declarative manner.
  • Create visually interesting effects by combining provided callbacks with CSS.

Installation

npm - npm i typerbot

CDN - https://cdn.jsdelivr.net/npm/typerbot@latest/dist/typerbot.min.js


Initialization

Typerbot(fieldElement, [options])

fieldElement: HTMLElement, Element in which text will be entered.

options: Object, settings used for given input. These will overwrite the default settings.

	var settings = {} // put your settings here
	var myTyperBot = new TyperBot(Document.querySelector(".field-element"), settings) // default settings will be used if none are provided

Default Options

| Property | Description | Type | Default Value | | ------------ | ------------ | ------------ | ------------ | | keystrokeInterval | controls the speed of inputs in Milliseconds | Number | 200 | | keystrokeDelay | amount of time in milliseconds that Typerbot.move(), Typerbot.delete(), Typerbot.deleteUntilDelimiter(), Typerbot.moveToStart(), Typer.moveToEnd() and Typerbot.deleteAll() will wait before executing | Number | 0 | | pauseDuration | amount of time in milliseconds that Typerbot.pause() will wait for | Number | 1000 | | cursorBlinkInterval | amount of time in milliseconds between cursor blinks | Number | 800 | | cursorClass | CSS class to be applied to the cursor element | String | "typerbot-cursor" | | html | will HTML passed into Typerbot.type() be parsed as HTML or as plaintext | Boolean | Hello | | cursor | controls whether the cursor is visible | Boolean | true | | cursorString | character that appears as cursor | String |"|" | | afterLineComplete | callback that executes at the end of Typebot.type() | Function | () => {} | | beforeLineComplete | callback that executes at the start of Typebot.type() | Function | () => {} | | beforeKeyInput | callback that executes after Typerbot before a character is entered/deleted or the cursor is moved | Function | () => {} | | afterKeyInput | callback that executes after Typerbot after a character is entered/deleted or the cursor is moved | Function | () => {} |

Methods

Typerbot.type(stringInput, [options]) : Promise

Insert characters into the field element.

  • stringInput: String, string that will be entered into the field element.

  • options: Object, settings used for given input. These will overwrite the default settings as well as settings provided in the constructor.


Typerbot.delete(numberOfCharactersToDelete, [options]) : Promise

Delete a specified number of characters from the field element with the cursor as the starting point.

  • numberOfCharactersToDelete: Number, number of characters that will be deleted.

  • options: Object, settings used for given input. These will overwrite the default settings as well as settings provided in the constructor.


Typerbot.deleteUntilDelimiter(delimiter, [options]) : Promise

Deletes characters until the provided delimiter is encountered.

  • delimiter: String, Delimiter used to determine when to stop deleting characters.

  • options: Object, settings used for given input. These will overwrite the default settings as well as settings provided in the constructor.


Typerbot.move(numberOfcharactersToMove, [options]) : Promise

Move the cursor a specified number of positions.

  • numberOfCharactersToMove: Number, Element in which text will be entered

  • options: Object, settings used for given input. These will overwrite the default settings as well as settings provided in the constructor.


Typerbot.moveToEnd([options]) : Promise

Moves cursor to the end of the field element.

  • options: Object, settings used for given input. These will overwrite the default settings as well as settings provided in the constructor.

Typerbot.clear()

Clear all characters from fieldElement and resets Typerbot instance internal state.


Typerbot.freeze()

Hides cursor and prevents new inputs methods from being executed.


Typerbot.unfreeze()

Reverses the effects of Typerbot.freeze().


Typerbot.isFrozen() : Boolean

Returns boolean indicating whether or not Typerbot instance is frozen.