2020-08-18 html的最喜爱标签 + css的下雨动画 + JS的取消promise + 软技能的扫码登录原理及流程

2020-08-17 题目来源:http://www.h-camel.com/index.html

[html] 你最喜欢html的哪个标签?为什么?

meta

[css] 使用css3制作下雨动画的效果

线性渐变、阴影、缩放来实现下雨动画

https://www.imooc.com/article/279422

[js] 如何取消promise

1.reject

function hello() {
  let _res, _rej: any;

  const promise = new Promise((res, rej) => {
    _res = res;
    _rej = rej;
    setTimeout(() => {
      res("hello world");
    }, 5000);
  });
  return {
    promise,
    abort: (opt = {}) => {
      _rej({
        name: "abort",
        message: "the promise is aborted",
        aborted: true,
        ...opt
      });
    }
  };
}

const { promise, abort } = hello();
promise.then(console.log).catch(e => {
  console.log(e);
});

abort();

2.Promise.race

const promise = new Promise(function(res) {
  setTimeout(res, 5000, "hello world");
});

const abort = new Promise(function(_, _abort) {
  _abort({
    name: "abort",
    message: "the promise is aborted",
    aborted: true
  });
});

Promise.race([promise, abort])
  .then(console.log)
  .catch(e => {
    console.log(e);
  });

[软技能] 请说说扫码登录的原理及流程

一篇文章搞定:扫码登录实现原理 https://blog.csdn.net/chenssy/article/details/103839484

你可能感兴趣的:(每日3+1,JavaScript,CSS,javascript,css,css3,html5,html)