[TOC]

https://github.com/Advanced-Frontend/Daily-Interview-Question
https://github.com/haizlin/fe-interview
https://codepen.io/tech_query/pen/aboGgwY
https://leetcode-cn.com/
leetcode 精讲
https://xiaochen1024.com/courseware/60b4f11ab1aa91002eb53b18/61963bcdc1553b002e57bf13
c语言获取mac
https://wenku.baidu.com/view/129d6335a11614791711cc7931b765ce05087a9b.html
算法
https://www.geekxh.com/1.5.%E6%BB%91%E5%8A%A8%E7%AA%97%E5%8F%A3%E7%B3%BB%E5%88%97/502.html#_02%E3%80%81%E9%A2%98%E7%9B%AE%E5%88%86%E6%9E%90
时序图
https://www.processon.com/diagrams

setImmediate

这是一个实验性质的api,慎用

// 该方法用来把一些需要长时间运行的操作放在一个回调函数里,在浏览器完成后面的其他语句后,就立刻执行这个回调函数

if (!window.setImmediate) {
  window.setImmediate = function(func, args){
    return window.setTimeout(func, 0, args);
  };
  window.clearImmediate = window.clearTimeout;
}

var immediateID = setImmediate(func, [param1, param2, ...]);
var immediateID = setImmediate(func);

解决横向滚动条不能用鼠标拖动的问题

export function browserRedirect () {
  //
  const sUserAgent = navigator.userAgent.toLowerCase()
  function regexpMatch (str, regexp) {
    const array = str.match(regexp) || ['undef']
    return array[0]
  }
  const bIsIpad = regexpMatch(sUserAgent, /ipad/i) === 'ipad'
  const bIsIphoneOs = regexpMatch(sUserAgent, /iphone os/i) === 'iphone os'
  const bIsMidp = regexpMatch(sUserAgent, /midp/i) === 'midp'
  const bIsUc7 = regexpMatch(sUserAgent, /rv:1.2.3.4/i) === 'rv:1.2.3.4'
  const bIsUc = regexpMatch(sUserAgent, /ucweb/i) === 'ucweb'
  const bIsAndroid = regexpMatch(sUserAgent, /android/i) === 'android'
  const bIsCE = regexpMatch(sUserAgent, /windows ce/i) === 'windows ce'
  const bIsWM = regexpMatch(sUserAgent, /windows mobile/i) === 'windows mobile'
  if ((bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM)) {
    return true
  }
  return false
}

export const mouseDown = function (e) {
  if (browserRedirect()) {
    return
  }
  const currentTarget = e.currentTarget
  this.scrollFlag = true
  this.scrollLeft = currentTarget.scrollLeft
  this.startX = e.clientX
  const self = this
  this.mouseUp = document.addEventListener('mouseup', (e) => {
    self.scrollFlag = false
    self.linkFlag = false
    // 为了阻止a标签跳转恢复 start
    setTimeout(function () {
      const links = currentTarget.querySelectorAll('a') || []
      for (let i = 0; i < links.length; i++) {
        const link = links[i]

        if (link) {
          const href = link.getAttribute('selfHref')
          if (href !== 'javascript:;') {
            link.setAttribute('href', href)
          }
        }
      }
    })
    // 为了阻止a标签跳转恢复 end
    document.removeEventListener('mouseup', this.mouseUp)
  })
}
export const mouseMove = function (e) {
  if (browserRedirect()) {
    return
  }
  const currentTarget = e.currentTarget
  let scrollLeft = 0
  if (this.scrollFlag) {
    if (!this.linkFlag) {
      this.linkFlag = true
      // 为了阻止a标签跳转 start
      const links = currentTarget.querySelectorAll('a') || []
      for (let i = 0; i < links.length; i++) {
        const link = links[i]

        if (link) {
          const href = link.getAttribute('href')
          if (href !== 'javascript:;') {
            link.setAttribute('selfHref', href)
            link.setAttribute('href', 'javascript:;')
          }
        }
      }
    }
    // 为了阻止a标签跳转 end
    scrollLeft = this.scrollLeft + (this.startX - e.clientX)
    currentTarget.scrollLeft = scrollLeft > 0 ? scrollLeft : 0
  }
}

export default {
  browserRedirect,
  mouseDown,
  mouseMove
}

script 同步与异步

1)、把