02 2018 档案
摘要:In this lesson we are going to use CSS variables to keep our application's colors consistent. This includes defining the variables inside our the pseu
阅读全文
摘要:The main reason you want to do I"nlining images with SVG and data URIs" is to reduce http request. If you doing "Inlining images with SVG and data URI
阅读全文
摘要:// Asynchronous iteration --> Symbol.asyncIterator async function main() { const syncIterable = [ Promise.resolve('a'), Promise.resolve('b'), ]; for await (const x of sync...
阅读全文
摘要:In this lesson, you will learn how to implement pytest fixtures. Many unit tests have the same resource requirements. For example, an instantiated obj
阅读全文
摘要:Body with background image and gradient Body with elaborate background using only CSS Using CSS background images for conditional image display Using
阅读全文
摘要:'cover': The smaller axies of image (x axies) should match smaller axies (x axies) of container. So some part of image might be cut off. 'container':
阅读全文
摘要:In this lesson, I use Enzyme and Jest's Snapshot functionality to write an integration test for a component called CounterConsumer that consumes the R
阅读全文
摘要:In this lesson, I use Enzyme and Jest to unit test a Counter Render Prop component. Writing integration tests are perfect for components that consume
阅读全文
摘要:Take few examples: Full size image: The problem for that is it overflow when the screen size is smaller than the image size. (BAD) width: 100%: The pr
阅读全文
摘要:React's abstraction over the DOM means that it's not always obvious how to do DOM-related things, like working with the HTML Canvas API. When working
阅读全文
摘要:When the screen size is small, we can use "no more table" solution. So instead of render table is row layout, we render it in column layout. Given the
阅读全文
摘要:In this lesson we are going to use Google's Puppeteer to gather metrics about a page's load time. We'll use a high level date subtraction method as we
阅读全文
摘要:The React documentation has been warning us for a long time now that context shouldn't be used and that the API is unstable. Well, with the release of
阅读全文
摘要:Every Angular CLI generated project comes already with Karmapreinstalled as well a couple of executable Jasmine specs. The default test reporter is "p
阅读全文
摘要:1. First you have enable "Developer mode" on your mobile device. (Different device might be different) "Settings" -> Click "Build Number" 7 times. 2.
阅读全文
摘要:Using the New Device Emulation Interface The Device Emulation interface changed a bit with the newer version of Chrome Dev Tools. Here are the instruc
阅读全文
摘要:In a proper unit test we want to isolate external dependencies as much as possible to guarantee a reliable test outcome. Http calls represent such ext
阅读全文
摘要:In some cases your application might need to upload large amounts of data, such as files. Obviously for a good UX we should provide the user some feed
阅读全文
摘要:By default the new Angular Http client (introduced in v4.3.1) uses JSON as the data format for communicating with the backend API. However, there migh
阅读全文
摘要:By default the response body doesn’t contain all the data that might be needed in your app. Your server might return some special header which you hav
阅读全文
摘要:Besides sending (or requesting) the actual data to the server API, there’s also often the need to send further metadata that helps the server to corre
阅读全文
摘要:When communicating with some backend API, data travels over the network using the HTTP protocol. As such, failures may occur, be it on our own device
阅读全文
摘要:Obviously in a real world application we do not only fetch data from the backend, but we also send data to be stored permanently on the server side. T
阅读全文
摘要:In this lesson, you’ll install Gatsby and the plugins that give the default starter the ability to transform Markdown into HTML. Install: Create a pro
阅读全文
摘要:Generic Fucntion: For example we have a set of data and an function: When we check the 'clones' type, you can see it is 'any[]'. To add more type info
阅读全文
摘要:Motion is an important aspect of a complete immersive experience, therefor we are going to look into the animation API Animated. Animated allows us to
阅读全文
摘要:React VR isn't limited to simple 3D primitives. By using the <Model/> Component we can place a complex 3D models into our scene.
阅读全文
摘要:In order to illuminate a scene containing 3D objects a lighting setup is required. In this lesson we'll walk through the available lighting components
阅读全文
摘要:React VR ships with a handful of 3D primitives. We'll importprimitives like <Sphere/>, <Box/>, <Cylinder/>, and <Plane/> and explore how they can posi
阅读全文
摘要:Hyperapp is an ultra lightweight (1kb), minimal, functional, JavaScript library for building UIs. It comes with a VDOM engine and state management wit
阅读全文
摘要:Hyperapp is an ultra lightweight (1kb), minimal, functional, JavaScript library for building UIs. It comes with a VDOM engine and state management wit
阅读全文
摘要:We will learn how to set up a React VR project, run the development mode with hot reloading, and take a small dive into the generated code and make a
阅读全文
摘要:We can execute generators from generators, and delegate the iteration control with the yield* keyword. Yo dawg, I heard you like generators, so I put
阅读全文
摘要:Flowchart.js is a great tool for creating quick, simple flowcharts in a way that keeps you out of a WYSIWYG, and keeps your productive. No more drawin
阅读全文
摘要:In the constructor, we want to set the prop to readonly, you need to do like this:
阅读全文
摘要:In this lesson you will create a new project with a virtual environment and write your first unit test with pytest. In doing so, you will learn: insta
阅读全文
摘要:React.PureComponent is similar to React.Component. The difference between them is that React.Component doesn’t implement shouldComponentUpdate(), but
阅读全文
摘要:@Directive({ // tslint:disable-next-line:directive-selector selector: '[scrollable]' })
阅读全文
摘要:If you're coming from AngularJS (v1.x) you probably remember the ng-true-value and ng-false-value directive which allowed to map custom boolean values
阅读全文
摘要:When you have a checkbox, not necessary that just 'ture' & 'false', you might have 'yes', 'no', '1', '0': There is how to use ng-true-value and ng-fal
阅读全文
摘要:To fix Promise is not recolized in TypeScript, we can choose to use a lib: we can also use built-in libs: Inside "es6" have Promise already, so that w
阅读全文
摘要:To using decorate, we can modifiy tsconfig.json: So for example we want to build a '@LogMethod' decorator, which arroding to the system logging level
阅读全文
摘要:Since MST offers a runtime type system, it can create and compose types on the fly, making it possible to reuse logic in new and powerful ways. In thi
阅读全文