12 2018 档案
摘要:It's possible to access some, but not all, of the native device features from a PWA. One that we canaccess, is the camera and camera roll. We'll use t
阅读全文
摘要:Because an installed PWA is really just a web app running in a browser, there are some browser behaviors that we may not want in our app, if we're goi
阅读全文
摘要:Android displays a splash screen for PWAs based on the icons and names you provide, but iOS just displays a solid color splash screen for installed PW
阅读全文
摘要:We're storing JSON data in the cache - but that only applies to HTTP GET requests - and not to POST or DELETE requests. We'll add a fetch event listen
阅读全文
摘要:We can view the PWA offline because we are caching the static and CDN assets for the app - but the list of todo items won't display, because those API
阅读全文
摘要:Our service worker caches our static assets - but only those assets that are included in our React App. This means that assets like Bootstrap, which w
阅读全文
摘要:The default service worker that comes with create-react-app doesn't allow for very much configuration. We'll replace that default service worker in tw
阅读全文
摘要:The k-nearest neighbors algorithm is used for classification of unknown items and involves calculating the distance of the unknown item's neighbors. W
阅读全文
摘要:It is not clear in the Docs about {read: xx} option for @ViewChild. Based on the Source code, @ViewChild as view as Component, ElementRef, TemplateRef
阅读全文
摘要:The usecase is very simple: '=0' & '=1' are exactly match, 'other' are category match for the rest of numbers, you have to use 'other', this is the ru
阅读全文
摘要:Let's say you want to rending some component based on condition, for example a Tabs component. Inside tabs, you want to render different tab component
阅读全文
摘要:Every dynamic programming algorithm starts with a grid. It entails solving subproblems and builds up to solving the big problem. Let’s break down a pr
阅读全文
摘要:When want to display different component based on some conditions:
阅读全文
摘要:Using ngClass for conditional styling, here is the usage from the docs: It is also recommended when the conditional logics is complicated, we can usin
阅读全文
摘要:Binary search is an algorithm that accepts a sorted list and returns a search element from the list. It provides a dramatic performance boost over sea
阅读全文
摘要:Merge sort is a recursive sorting algorithm. If you don't understand recursion, I recommend finding a resource to learn it. In brief, recursion is the
阅读全文
摘要:nsertion sort is another sorting algorithm that closely resembles how we might sort items in the physical world. We start at the second item in our co
阅读全文
摘要:A binary tree is a tree where each node may only have up to two children. These children are stored on the leftand right properties of each node. When
阅读全文
摘要:Quicksort (also called partition sort and pivot sort) is arguably the most used sorting algorithm. It is the one commonly implemented internally in la
阅读全文
摘要:In a tree, nodes have a single parent node and may have many children nodes. They never have more than one parent nor point to any siblings. The most
阅读全文
摘要:Depth first search is a graph search algorithm that starts at one node and uses recursion to travel as deeply down a path of neighboring nodes as poss
阅读全文
摘要:Recursion is when a function calls itself. This self calling function handles at least two cases, the recursive case and the base case. People seem to
阅读全文
摘要:n this lesson, we'll go over how bash functions work. Bash functions work like mini bash scripts--you can pass parameters and invoke them just like a
阅读全文
摘要:The await operator is used to wait for a promise to settle. It pauses the execution of an async function until the promise is either fulfilled or reje
阅读全文
摘要:Breadth first search is a graph search algorithm that starts at one node and visits neighboring nodes as widely as possible before going further down
阅读全文
摘要:A graph is a data structure comprised of a set of nodes, also known as vertices, and a set of edges. Each node in a graph may point to any other node
阅读全文
摘要:A linked list is a collection of items where each item points to the next one in the list. Because of this structure, linked lists are very slow when
阅读全文
摘要:A stack is a collection of items that obeys the principle of "last in, first out". Like a stack of plates, we can only access the topmost plate at any
阅读全文
摘要:In this lesson, you will learn how to create a queue in JavaScript. A queue is a first-in, first-out data structure (FIFO). We can only remove items f
阅读全文
摘要:The idea is wrap a object with all its function methods and add some additional handling into a new object. For example, we have a object 'fireEvent':
阅读全文
摘要:It is hard to explain css selector specificty, to easy way to understand it is by playing around with it. To remember some rules can be helpful: inlin
阅读全文
摘要:Sometimes, you might want to convert a JavaScript function that accepts a callback to one that returns a Promiseobject. This lesson shows how to manua
阅读全文
摘要:For a file which contians lots of lines of code, we can use 'comments region' to collapse the code.
阅读全文
摘要:Use custom Cypress command for reusable assertions We’re duplicating quite a few commands between the registration and login of our user for assertion
阅读全文
摘要:Use Cypress to test user registration Let’s write a test to fill out our registration form. Because we’ll be running this against a live backend, we n
阅读全文
摘要:Despite the fact that Cypress is an application that runs natively on your machine, you can install it and add it as a dependency just like all other
阅读全文
摘要:Pseudo elements allow us to target elements that are not explicitly set in the DOM. Using ::before ::after we can actually create and manipulate eleme
阅读全文
摘要:Using just semantic CSS Pseudo-Classes you can help define important states for form elements that ensure the user provides the correct data without f
阅读全文
摘要:The interactive pseudo-classes for links (and buttons) allow us to make sure the user knows what elements on the page are interactive and that they ca
阅读全文