Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 1.82 KB

File metadata and controls

28 lines (18 loc) · 1.82 KB

Browser REST client using the platform only

This project implements a pure Typescript REST - Client implemented without any foreign UI-libraries (no Angular, no Vuejs, no React, no Redux, no lit-html, no Polymer...). The example shows how to implement the Model View Controller Architecture in a browser client application.

The example makes use of Custom Elements and the Shadow DOM. Both are implemented natively in all popular browsers that we are interested in, so this gives optimal performance. Other browsers are shimmed by using webcomponents.

We do mix two simple things: mutation and asynchronicity that - when mixed together - can behave like menthos and coke. For Details see this blog post.

To avoid all that we use Observables and make use of 3 fundamental design principles:

  • Single source of truth
  • Read Only State
  • Changes are made with pure functions

We use Typescript to implement this, but without the heavy overhead that would be neccessary with libraries like Redux or Immutablejs. Although we do not use Redux, we use immer for implemening the producers for our read only application state.

See model.ts and store.ts in the project as an example.

You should propably install an extension to get the syntax highlighting for the html templates in your code editor.