小编Bri*_*ian的帖子

在渐进式 Web 应用程序中是否可以实现真正的持久存储?

我读所描述的两个存储的API,在缓存API和IndexedDB的,但它似乎既不存储选项是真正持久的离线存储指南PWA的。Cache API 是临时设计的,当用户清除浏览器缓存时可以擦除 IndexedDB 数据。

那么,是否有可能在 PWA 中拥有真正的持久存储?我想要做的是:

  1. 用户在他们的智能手机上访问我的网站,我在 JavaScript 中生成了一个唯一的 ID。
  2. 他们在 iOS 上按“添加到主屏幕”或在 Android 上按“添加到主屏幕”栏。
  3. PWA 被添加到他们的手机中。此时,我想持久存储该唯一 ID。

有什么办法可以这样做吗?也许是我不知道的 API?我只需要一个很小的唯一代码,因为这个 PWA 不是为了让用户使用 cookie 登录。

progressive-web-apps

9
推荐指数
1
解决办法
4365
查看次数

基础媒体查询在font-family中

在Foundation中,主要的CSS文件以此开头

meta.foundation-mq-small {
  font-family: "/only screen and (max-width: 40em)/";
  width: 0em; }

meta.foundation-mq-medium {
  font-family: "/only screen and (min-width:40.063em) and (max-width:64em)/";
  width: 40.063em; }

meta.foundation-mq-large {
  font-family: "/only screen and (min-width:64.063em)/";
  width: 64.063em; }

meta.foundation-mq-xlarge {
  font-family: "/only screen and (min-width:90.063em)/";
  width: 90.063em; }

meta.foundation-mq-xxlarge {
  font-family: "/only screen and (min-width:120.063em)/";
  width: 120.063em; }
Run Code Online (Sandbox Code Playgroud)

为什么font-family属性中有媒体查询?

css zurb-foundation

7
推荐指数
1
解决办法
2225
查看次数

如何在PHP函数的PhpStorm中禁用自动完成红色边框

随着对PhpStorm 2016.1.1的更新,当我从PhpStorm在自动完成中建议的列表中选择一个函数时,它将在带有红色边框的函数参数中插入变量.

有没有办法禁用注入变量和红色边框,但保持功能名称自动完成?

例

phpstorm

7
推荐指数
1
解决办法
362
查看次数

MutationObserver 未拾取子节点

小提琴: https: //jsfiddle.net/7gj26hqu/

我想要一个MutationObserver能够检测自身内部所有新节点的节点。在示例中,我设置了{childList: true, subtree: true},但div#nested没有出现在MutationObserver(在控制台中显示)。

如何让观察者检测子节点的任何深度?

const domObserver = new MutationObserver((records) => {
  records.forEach((record) => {
    console.log(record)
  })
})

domObserver.observe(document.querySelector('#frame'), {childList: true, subtree: true})

// copy child nodes out of #template (as a string) and inject them into #frame for the observer to detect
document.querySelector('#frame').innerHTML = document.querySelector('#template').innerHTML
Run Code Online (Sandbox Code Playgroud)
<div id="frame"></div>

<div id="template" style="display: none;">
   <div class="level-1">
    <div class="level-2">

      <div id="nested">
        I exist in the DOM but am not being seen by …
Run Code Online (Sandbox Code Playgroud)

javascript mutation-observers

5
推荐指数
1
解决办法
3005
查看次数