Global Object --- Proxy

The Proxy object enables you to create a proxy for another object, which can intercept and redefine fundamental operations for that object. Proxy对象让我们可以为另一个对象创建一个代理。这个代理可以拦截目标对象的调用、重新定义其基本操作。

Read More

Require VS Import

require() in JavaScript

This is an in-built node.js statement and is most commonly used to include modules from other separate files. It works by reading the JS file, executing it, and returning the object being exported. It is very popular for its ability to incorporate core node modules, community-based, and even local modules.

Read More

How Angular Change Detection Work?

How is change detection implemented?

Angular can detect when component data changes, and then automatically re-render the view to reflect that change. But how can it do so after such a low-level event like the click of a button, that can happen anywhere on the page?

Read More

Javascript Event Looping

Event Loop

The event loop concept is very simple. There’s an endless loop, where the JavaScript engine waits for tasks, executes them and then sleeps, waiting for more tasks.

Read More

Javascript Generator Function

Key Facts About Generator Functions

A generator function is quite different from normal functions. To create a generator, we will have to use “function*” as the syntax construct.

Read More

Tagged Template Literals(翻译)

Tagged template literal is the advanced concept of template strings, it allows you to pass a string through a function. The first argument of the tag function contains an array of string values from your template literals, the rest arguments contain the expressions of your template literal. 标记的模板字符串(Tagged template literals)是模板字符串(template strings)的一个高级概念。通过它你可以给一个参数化的函数(标记函数)传递一个字符串。而标记函数接收到的第一个参数就是字符串数组(string[]),数组的每个成员就是模板中的字符串内容。第二个参数起,每个参数都对应一个模板中的表达式(${表达式})。

Read More

Global Execution Context

In Javascript, an execution context is an abstract container that holds information about the environment that a piece of code is being executed in. For every function call, a new execution context is created and added to the execution stack; a container that keeps information about the different execution contexts.

Read More

Avoiding common confusions with modules in Angular

Module encapsulation:

Angular introduces the concept of module encapsulation in a way similar to ES modules. It basically means that declarable types — components, directives and pipes — can only be used by components declared inside this module. For example, if I try to use a-comp from the A module inside App component from the App module:

Read More

Letterforms, Serif, Sans Serif and Mono(Monospace)

I didn’t even know that fonts can be categorized into a couple of letterforms, Serif, Sans Serif and Mono(Monospace), until today… Let’s from where I started. A guy’s handling a font related issue this morning. And I just wanted to figure out how to find which font the browser would fall in when all fonts specified in CSS weren’t installed on the client. Then I binged this page and after navigating to the page above, the table below surfaced:

Read More

Blog With Jekyll

Create a blog site

For blogging, we have to specify a local folder as the root of your blog site with the commands below:

Read More

Sync Gulp Tasks

I have already known that Gulp runs tasks in parallel and there’re several ways to ensure tasks run in order.

Read More

ERROR missing Change-Id in commit message footer

Today, my first day of contributing code to another new project.

I failed to push commits to Gerrit with the error ‘ERROR: missing Change-Id in commit message footer’.
After googled, I found my answer already offered by Gerrit that is the Gerrit has been configured always requiring a Change-Id in the commit message.

And the simple way to fix this is to install a hook to automatically insert Change-Id on each commit.
either way below could obtain the hook from Gerrit for you:

Read More