JavaScript Runtime

The JavaScript engine and the JavaScript runtime are responsible for running JavaScript code, the JavaScript engine alone will freeze the page as long as the call stack is not empty. it means that the JavaScript engine is synchronous. but with the JavaScript runtime, we can run asynchronous code.

The JavaScript runtime is a set of features the exist in the browser and while the JavaScript engine runs our code synchronously, the browser works in the background.

Continue reading “JavaScript Runtime”

JavaScript Engine

The job of the JavaScript engine is to translate the JavaScript code that we write into something that the computer can understand which is 0 and 1.

There are a lot of JavaScript engines and one of them is the V8 engine by google (written in C++) which was released in 2008. Google had a problem with the basic engines that ran google Maps slowly so they created their engine. the result was an advanced engine that ran the JavaScript code faster.

Continue reading “JavaScript Engine”

Angular Service: State Management

communication is all about sharing and we can use services to share entity data across components. entity data can be for example posts, products, songs, movies and so on. this kind of service is a data access service.

We use the service as a data access service to encapsulate the common operations with data like get, add, update and delete data items. in the service we create methods that usually will make HTTP requests to get, add, update and delete data. each component that needs the data will use the service to get the data and will make an action on the data through the use of the service.

Continue reading “Angular Service: State Management”

Angular Content Projection and @ContentChild

Content projection with ng-content is a feature that can help us when we building a configurable reusable component.

ng-content is a directive that we can use as a selector and this serves as a hook you can put in a component to mark the place for angular where it should add any content it findes between the opening and closing tag of the component.

Continue reading “Angular Content Projection and @ContentChild”