TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Show HN: Replay your typing in a few lines of JavaScript

82 点作者 Einenlum大约 1 年前
I recently needed to make a text appear on a website and I wanted to get this real human feeling that computers don&#x27;t have. I only found the TypeIt lib but it was not free and I didn&#x27;t want to add a dependency for such a simple case.<p>Human replay allows to copy paste a few lines of JS to make a text appear exactly how you typed it.

17 条评论

OmarShehata大约 1 年前
This is great!<p>I was just talking to a coworker today about &quot;libraries&quot; vs &quot;templates&quot;. You could have made this a library, but I think it&#x27;s actually way nicer for it to be code I can copy&#x2F;paste, so I can integrate it however I want. Some things are better as templates that I can copy.<p>If I have a weird use case or want to integrate it deeply into something else, the library doesn&#x27;t need to accommodate that.<p>(the tradeoff of course is, if you update the library, my copied code won&#x27;t update, so obviously this doesn&#x27;t work for everything, but I think it works for some things!)
jmkni大约 1 年前
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
评论 #39565559 未加载
评论 #39568304 未加载
darkest_ruby大约 1 年前
What is everyone excited about? A mediocre piece of code that actually hardcodes th string? Same could be achieved with generic code with 2 Parms - a string, and duration
评论 #39571717 未加载
michaelmior大约 1 年前
Not quite the same, but if you want to do this with a terminal session, asciinema[0] is great!<p>[0] <a href="https:&#x2F;&#x2F;asciinema.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;asciinema.org&#x2F;</a>
sonofhans大约 1 年前
This is nice.<p>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&#x2F;arrow keys, etc.<p>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?
评论 #39568291 未加载
评论 #39567790 未加载
评论 #39571365 未加载
daniel_iversen大约 1 年前
That’s cool. Wonder how well this could be used to create a digital fingerprint of users?
评论 #39568595 未加载
评论 #39568877 未加载
mosselman大约 1 年前
While we are on the subject: what does chatgpt use for the typing effect they have?<p>I know a stream of diffs comes in, but I think the animation is smoothened by something.
评论 #39577352 未加载
Einenlum大约 1 年前
Update: I first had a naive approach and stored the full content of the text on each stroke. I updated the code with some small algorithm to reduce data and avoid storing the full text when a character was added or removed.
js4ever大约 1 年前
Amazing, I love how it&#x27;s generating short js code and no library needed
评论 #39568301 未加载
t_zahil大约 1 年前
What a smart idea! I immediately sent it to my mom who has such a weird way of typing can&#x27;t wait to see if the AI can reproduce it!
avery17大约 1 年前
Hold backspace from the end until you erase everything. Start recording and hold down undo(ctrl-z). You&#x27;re welcome.
codetrotter大约 1 年前
It even captures changes made by iOS when auto correct changes the capitalization and spelling of words! :D
anon115大约 1 年前
a web component in vanilla js would fit nice here
评论 #39673049 未加载
评论 #39574654 未加载
p2hari大约 1 年前
Really cool. Thanks for sharing.
评论 #39574650 未加载
tamimio大约 1 年前
Cool!! Thanks for sharing it.
评论 #39575402 未加载
amelius大约 1 年前
Why can I only replay once?
评论 #39568375 未加载
评论 #39567035 未加载
MegaSec大约 1 年前
Man, this is really cool!
评论 #39568294 未加载