O'Reilly logo

TypeScript: Modern JavaScript Development by Ivo Gabe de Wolff, Vilic Vane, Remo H. Jansen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating the main view

The main view will show a list of recent scans. Clicking on one of the recent scans opens a details page that shows more details on the scan. When a user clicks on the Scan button, the user can scan a QR code using the camera:

Creating the main view

First, we create the model of a scan in src/model.ts. We need to store the content (a string) and the date of the scan:

export interface Scan { 
  content: string; 
  date: Date; 
} 

In src/view/main.ts, we will create the view. The view should export a function that creates the page, so we can use it as the mainEntry. It also needs to export a function that can update the content. The view has two callbacks ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required