2020-08-18 html favorite tag + css rain animation + JS cancellation promise + soft skills scan code login principle and process

2020-08-17 Source of topic: http://www.h-camel.com/index.html

[html] Which tag of html do you like best? why?

meta

[css] Use css3 to make the effect of rain animation

Linear gradient, shadow, zoom to achieve rain animation

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

[js] How to cancel a 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);
  });

[Soft Skills] Please tell me the principle and process of scanning code login

An article is done: the realization principle of scan code login https://blog.csdn.net/chenssy/article/details/103839484

Guess you like

Origin blog.csdn.net/vampire10086/article/details/108491451