Promise chain call, exception penetration and interrupt promise chain

promise. Parameters of then() . then is a method on promise prototype, which returns a promise object, which can accept two callback parameters: 1 onResolved, 2. Onrejected, these two parameters have one parameter respectively, which is the data of successful execution and the data of failed execution. In fact, the first callback function ...

Added by dodgeqwe on Fri, 31 Dec 2021 06:52:55 +0200

Front end performance and loading experience Optimization Practice (attached: PWA, offline package, memory optimization, pre rendering)

1, Background: why does the page get stuck? 1.1 long waiting time (performance) The package / third-party script of the project itself is relatively large.JavaScript execution blocks page loading.Pictures are large and numerous. Especially for the white screen time in the first screen resource loading, the longer the user waits, and the sl ...

Added by dsnhouse on Fri, 31 Dec 2021 03:19:10 +0200

Students' DW static web page design - good code quality - final assignment of HTML+CSS+JavaScript web page production in their hometown of Guangzhou (5 pages)

HTML5 final assignment: website design in hometown Guangzhou - good code quality - final assignment of HTML+CSS+JavaScript web page production in hometown Guangzhou (5 pages) Common web design topics include individuals, food, companies, schools, tourism, e-commerce, pets, electrical appliances, tea, home, hotels, dance, animation, stars, c ...

Added by chris_2001 on Fri, 31 Dec 2021 00:25:25 +0200

React implements the basic application of todolist and components

Implement the basic ToDolist with react The last time I learned how to build a basic react framework, today I'll try to write a ToDolist to exercise my logic ability First, we should build a basic framework and fill in two sets of default data import React, { Component } from 'react'; class App extends Component { constructor(props) { ...

Added by frost on Thu, 30 Dec 2021 23:49:00 +0200

webpack personal notes

In essence, webpack is a static module bundler for modern JavaScript applications. When webpack processes an application, it recursively builds a dependency graph that contains each module required by the application, and then packages all these modules into one or more bundle s. install md mypack //New folder cd mypack // Enter your projec ...

Added by inferium on Thu, 30 Dec 2021 17:01:49 +0200

Using JavaScript to implement a simple web version calculator

background Because I was assigned to a new project team, the project needs js. Because I haven't contacted it, the leader is going to give me a week to study. Yes, realizing a simple calculator that supports four mixed operations is an assignment, so I have this article Therefore, the main focus of this article is not html and css. After all, ...

Added by stride-r on Thu, 30 Dec 2021 16:53:29 +0200

Elegant asynchronous programming version answer async and await parsing

​ catalogueWhat are aysnc and awaitWhy asyncWhat does the aysnc function solveAdvantages of async functionHow to use async functionasync function syntax await syntaxerror handlingBasic structure of async+awaitmatters needing attentionWhat are aysnc and awaitThe async function is the syntax sugar of the Generator function. Use the Generator func ...

Added by thomasob on Thu, 30 Dec 2021 14:55:06 +0200

Form data encoding and decoding -- encodeURIComponent, URLSearchParams, FormData

This article mainly explains how to deal with various parameter problems through web api to prevent security problems and more convenient operation. Let's take a look at an example: const response = await fetch(url, { method: 'POST', body: `text=${text}`, headers: { 'Content-Type': 'application/x-www-form-urlencoded' } }) const js ...

Added by Mikkki on Thu, 30 Dec 2021 13:34:33 +0200

With React hooks, you can spend more time fishing

🎙️ preface According to legend, react 17 has a very powerful function, that is, react hooks. In fact, react hooks is a bit similar to vue3's composition API. They all appear to improve development efficiency. Then, in the following article, we will start from 0 to 1 to show you about react hooks and some common API s. No more nonsense, ...

Added by mr_griff on Thu, 30 Dec 2021 12:31:36 +0200

react Foundation (installation, construction, basic usage)

1, What is react? React is a front-end programming framework. It is a javascript library used to build user interface. It originated from the internal project of Facebook. After being open-source, react has quickly become the most powerful tool for front-end engineers because of its convenient operation. React has high performance and very sim ...

Added by Chicken Little on Thu, 30 Dec 2021 11:16:11 +0200