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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

"Live Reload"-like feature with a single line of javascript

5 点作者 vjk2005将近 12 年前

2 条评论

_pius将近 12 年前
Very clever technique.<p>You may be able to improve it slightly depending on the particulars of your workflow. For example, you could do the refresh conditionally based on other factors, say, the protocol or pathname so that even if the line <i>did</i> make it into production, you&#x27;d still be ok.<p>Even better still would be to inject that javascript only in the development environment.
gregorkas将近 12 年前
That&#x27;s a great solution. Looking forward to trying it out. Thanks!