06 2016 档案
摘要:If you’re only instrumenting the files in your project that are under test then your code coverage report will be misleading and it will be difficult
阅读全文
摘要:How much of your code runs during unit testing is an extremely valuable metric to track. Utilizing code the karma-coverage plugin and babel-plugin-__c
阅读全文
摘要:When writing tests run by Karma for an application that’s bundled with webpack, it’s easiest to integrate webpack and Karma directly together. In this
阅读全文
摘要:When you have a dependency that has dependencies on global variables (like jQuery or lodash) or assumes that this is bound to window, you can use the
阅读全文
摘要:Let's try creating a deeper tree structure. This time we have 4 separate arrays each containing lists, videos, boxarts, and bookmarks respectively. Ea
阅读全文
摘要:1. Use a for loop to traverse the videos and bookmarks array at the same time. For each video and bookmark pair, create a {videoId, bookmarkId} pair a
阅读全文
摘要:Three ways to make object immutable: 1. Use JSON.parse(JSON.stringify(obj)): this approach is little bit expense. 2. Use Object.create() This is a che
阅读全文
摘要:concatAll: Exercise 12: Retrieve id, title, and a 150x200 box art url for every video You've managed to flatten a tree that's two levels deep, let's t
阅读全文
摘要:fetch() does the same thing as XHR, but fetch return a promise. Check the reponse API here: Link Besides text(), you can use json() or blob(). 'no-cor
阅读全文
摘要:You can fine tune several webpack plugins to make your bundle as small as it can be for your specific application. However there are a few things you
阅读全文
摘要:When you have a dependency that does not export itself properly, you can use the exports-loader to force it to export the pieces of the file that you
阅读全文
摘要:When you use ngrx/store and you want to fire a service request. When it sucessfully return the response, you need to dispatch action to tell the store
阅读全文
摘要:If you have a multi-page application (as opposed to a single page app), you’re likely sharing modules between these pages. By chunking these common mo
阅读全文
摘要:Often, you have dependencies which you rarely change. In these cases, you can leverage the CommonsChunkPlugin to automatically put these modules in a
阅读全文
摘要:Leveraging the browser cache is an important part of page load performance. A great way to utilize this cache is by versioning your resources. In this
阅读全文
摘要:As a Single Page Application grows in size, the size of the payload can become a real problem for performance. In this lesson, learn how to leverage c
阅读全文
摘要:If you're going to use code splitting with Webpack 2, you'll need to make sure the browser has support for the ES6 Promise API. This means that if you
阅读全文
摘要:The less code you can send to the browser, the better. The concept of tree shaking basically says that if you’re not using some piece of code, then ex
阅读全文
摘要:It’s quite common to make a mistake while developing your webpack configuration. A simple typo can cost you hours of development time. With webpack-va
阅读全文
摘要:There are several lessons that will build on top of this project. It is a fairly standard, small webpack bundled project. In this lesson we’ll explore
阅读全文
摘要:DOM hierarchy pseudo-classes allow you to style specific elements based on where they fall in the hierarchy and what type of elements they are. You ca
阅读全文
摘要:It's common in Javascript for functions to accept different argument types and to also return different types. In this lesson we learn how to 'teach'
阅读全文
摘要:slice filter map ...spread concat Object.assign
阅读全文
摘要:delete keyword doesn't actually delete the value but just the reference. So here, what actually delete is the point of me.name: So the point from 'anm
阅读全文
摘要:In this lesson, you will learn the difference between the exports statement and module.exports. Two examples are demonstrated, each accomplishing the
阅读全文
摘要:First, what is 'High Order function', basic just a function, inside the function return another fuction. For example: Decorators is a subset of high o
阅读全文
摘要:TypeScript allows you to generate definition files for your own libraries. This lesson shows you how to organize your project and generate the definit
阅读全文
摘要:When multiple decorators apply to a single declaration, their evaluation is similar to function composition in mathematics. In this model, when compos
阅读全文
摘要:new.target is a new “magical” value available in all functions, thoughin normal functions it will always be undefined. In any constructor,new.target a
阅读全文
摘要:Each function should have a 'name' property. It can be anonymous, empty, the same as function name, or class name. For example:
阅读全文
摘要:Original artial --> link How descorator looks like: Descorator in action: We have a class, which have an method call meow(): When Javascritp Engine re
阅读全文
摘要:Orgial aritial --> Link The problem with Angular 1 DI: Angular 2 DI: Solve the singletons problem: The service you inject to the parent component can
阅读全文
摘要:Oingial aritial --> Link Take away: When you use `templateUrl` & `styleUrls`, the path are relative to the application root. So if you compoennt is pu
阅读全文
摘要:TypeScript allows you to emit decorator metadata which enables more powerful features through reflection. This lesson show you how decorators and refl
阅读全文
摘要:Decorators are a feature of TypeScript that are becoming more and more common in many major libraries. This lesson walks you through what decorators a
阅读全文
摘要:Using TypeScript when installing packages from npm often requires you to install related definition files. This lesson shows you how to use typings to
阅读全文
摘要:One of the most confusing parts of getting started with TypeScript is figuring out how to use all the libraries that you know and love from JavaScript
阅读全文
摘要:This lesson covers using your first TypeScript Interface and what happens to the Interface when it is compiled down to JavaScript. Define the interfac
阅读全文
摘要:Beyond classes and IDs CSS also provides selectors to target element based on their attributes. In this lesson we'll look at selecting elements based
阅读全文
摘要:Files globs will be available in TypeScript 2.0, so in the meantime, we need to use "exclude" and "rootDir" to configure which files to load. This les
阅读全文
摘要:TypeScript will always compile even if there are ridiculous errors in your project. This lesson shows how to configure your .tsconfig with "noEmitOnEr
阅读全文
摘要:This lesson shows how to configure the .tsconfig so you only compile the .ts files you want. It then shows how to configure which directory you'd like
阅读全文
摘要:This lesson walks you through creating your first .tsconfig configuration file which will tell the TypeScript compiler how to treat your .ts files. In
阅读全文
摘要:This lesson shows you how to install TypeScript and run the TypeScript compiler against a .ts file from the command line. install: app.ts: RUN: You wi
阅读全文
摘要:We will learn how to fire up an async request when the route changes. A mock server data: We want to replace localStorge with mock server data, so rem
阅读全文
摘要:We will learn how centralized updates in Redux let us log every state change to the console along with the action that caused it.
阅读全文
摘要:We will learn how to normalize the state shape to ensure data consistency that is important in real-world applications. We currently represent the tod
阅读全文
摘要:We will learn how to encapsulate the knowledge about the state shape in the reducer files, so that the components don’t have to rely on it. In current
阅读全文
摘要:We will learn how to avoid the boilerplate code in mapDispatchToProps() for the common case where action creator arguments match the callback prop arg
阅读全文
摘要:We will learn how to use withRouter() to inject params provided by React Router into connected components deep in the tree without passing them down a
阅读全文
摘要:We will learn how adding React Router shifts the balance of responsibilities, and how the components can use both at the same time. Now when we click
阅读全文
摘要:Single, race both get only one emit value from the stream. Single(fn): race(...observable): Observable
阅读全文
摘要:Link : Video. 1. Firebase Auth: provides simple login with Github, Google, Facebook, Twittr. Link 2. Manifest: 3. Generate Mainfest and icons: Link 4.
阅读全文
摘要:We will learn how to change the address bar using a component from React Router. In Root.js: We need to add a param to change the Route: (:filter) mea
阅读全文
摘要:We will learn how to add React Router to a Redux project and make it render our root component. Install: Router should be wrapped inside Provider, the
阅读全文
摘要:We will learn how to better separate the code in the entry point to prepare it for adding the router. Currently, in the index.js, we configure the sto
阅读全文
摘要:We will learn how to use store.subscribe() to efficiently persist some of the app’s state to localStorage and restore it after a refresh. To save data
阅读全文
摘要:We will learn how to start a Redux app with a previously persisted state, and how it merges with the initial state specified by the reducers. The init
阅读全文
摘要:Mainly introduce two libaraies: sw-precache and sw-toolbox. Install: Types of caching Broadly, there are two types of caching Precaching—We'll precach
阅读全文
摘要:Libraries such as RxJS use generics heavily in their definition files to describe how types flow through different interfaces and function calls. We c
阅读全文
[React + Mobx] Mobx and React intro: syncing the UI with the app state using observable and observer
摘要:Applications are driven by state. Many things, like the user interface, should always be consistent with that state.MobX is a general purpose FRP libr
阅读全文