[HN Gopher] Show HN: Replay your typing in a few lines of JavaSc...
___________________________________________________________________
Show HN: Replay your typing in a few lines of JavaScript
I recently needed to make a text appear on a website and I wanted
to get this real human feeling that computers don't have. I only
found the TypeIt lib but it was not free and I didn't want to add a
dependency for such a simple case. Human replay allows to copy
paste a few lines of JS to make a text appear exactly how you typed
it.
Author : Einenlum
Score : 27 points
Date : 2024-03-01 16:25 UTC (6 hours ago)
(HTM) web link (einenlum.github.io)
(TXT) w3m dump (einenlum.github.io)
| OmarShehata wrote:
| This is great!
|
| I was just talking to a coworker today about "libraries" vs
| "templates". You could have made this a library, but I think it's
| actually way nicer for it to be code I can copy/paste, so I can
| integrate it however I want. Some things are better as templates
| that I can copy.
|
| If I have a weird use case or want to integrate it deeply into
| something else, the library doesn't need to accommodate that.
|
| (the tradeoff of course is, if you update the library, my copied
| code won't update, so obviously this doesn't work for everything,
| but I think it works for some things!)
| sonofhans wrote:
| This is nice.
|
| I'm curious -- it looks like you're storing the full text string
| along with the timestamp. At first I thought you were capturing
| keystrokes, but it makes more sense to capture the full text, so
| you can allow people to edit with mouse/arrow keys, etc.
|
| It will fall over at some point though, right? If you work on
| this more, is the next logical step to store a diff with each
| timestamp, rather than the full string?
| seafoamteal wrote:
| That's what I was thinking as well. I loved the demo, but was a
| bit surprised at how much redundant data was stored behind the
| scenes.
|
| Capturing keystrokes could still be a viable option if you
| maintained something like a virtual cursor that could move
| around the text display area.
|
| Or of course, diffs are the most straightforward way to do it.
| jmkni wrote:
| Very clever, I can imagine a chat app where you see the message
| how it was typed before seeing the final message sent, could be
| novel
| michaelmior wrote:
| Sounds like ICQ circa late 90s :)
| michaelmior wrote:
| Not quite the same, but if you want to do this with a terminal
| session, asciinema[0] is great!
|
| [0] https://asciinema.org/
| amelius wrote:
| Why can I only replay once?
| sourabhrathour wrote:
| exactly, there should have been to replay it for more number of
| times.
| MegaSec wrote:
| Man, this is really cool!
| js4ever wrote:
| Amazing, I love how it's generating short js code and no library
| needed
___________________________________________________________________
(page generated 2024-03-01 23:01 UTC)