CodeSky 代码之空

随手记录自己的学习过程

归档时间:2020-09

在 HTTP 网站中开启 Notification API

2020-09-24 22:33分类: JavaScript评论: 1

Notification API 只能在 HTTPS 中使用:Using the Notifications API

This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

但是在开发某游戏网站脚本的时候,虽然它用的是 HTTP,但是仍然想用 Notificition 做一下提醒功能,当然,可以降级成过去 800 年的闪 Title 策略:

1let shaking = false
2setInterval(() => {
3    if (shaking) document.title = `[Notification] ${word}!!`
4    else document.title = word
5    shaking = !shaking
6}, 200)
7

但是实测效果还是不够显眼,最终在和群友的交流之后,发现了 chrome://flags/

Insecure origins treated as secure 中填写需要开启 Notification API 的域名,重启浏览器,就可以在 HTTP 中使用 Notification API 了。

阅读更多 →

如何从一个 Chrome 的 Bug 中找到解决方案

2020-09-08 16:58分类: Other评论: 0

在前端开发,或者说 Web 开发中,我们会经常遇到,在某个浏览器遇到了问题,但是别的浏览器没有,过去,我们考虑的可能是 IE6 的兼容性,而在 Chrome 一骑绝尘的今天,Chrome 而其他浏览器没有的问题反而成为了更大的问题。

在此之前遇到过几个 Chrome Bug,我会以两个 Chrome Bug 为例说说实际是怎么解决的:

阅读更多 →

给华硕 AC88U 路由器安排上 clash

2020-09-08 13:48分类: Other评论: 0

下载版本

AC88U 需要的版本是 armv5 ,下载完成之后导入路由器,Country.mmdb 同理。

开机自启设置起来比较麻烦,我把下面的 iptables 放在了 firewall-start ,启动放在了 service-start里面。另外由于 daemonize 安装不了,所以直接 clash -d /jffs/clash > /dev/null 完事儿了。

阅读更多 →

Typescript import 引用中的一个小坑

2020-09-08 13:42分类: JavaScript评论: 1

之前有一个奋斗了 N 小时才搞定的问题,在 Nestjs 的单元测试中反复测试会报类似于:

Starting Nest throws following error: Nest can't resolve dependencies of the EventResolver (EventService, ?). Please make sure that the argument at index [1] is available in the EventModule context.
Nest throws an error about a circular dependency that doesn't exist. Here is the error thrown:
Nest cannot create the module instance. Often, this is because of a circular dependency between modules. Use forwardRef() to avoid it. (Read more https://docs.nestjs.com/fundamentals/circular-dependency.) Scope [RootModule -> XXXModule]
阅读更多 →
共 4 篇文章,1 页