O'Reilly logo

Cross-platform Desktop Application Development: Electron, Node, NW.js, and React by Dmitry Sheiko

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 a service to manage feed menu

Well, now we can fetch RSS feeds. But the plan was to have a manageable menu of feeds. I think, we can represent the menu in an array of items, where each item can be described with the following interface:

./app/ts/Interfaces/index.ts

export interface IMenuItem { 
  url: string; 
  title: string; 
  id: string; 
} 

As for the service itself, let's also start with the interface:

./app/ts/Services/IMenu.ts

import { IMenuItem } from "../Interfaces"; 
 
export interface IMenu { 
  items: IMenuItem[]; 
  clear(): void; 
  remove( url: string ): IMenuItem[]; 
  add( url: string, title: string ): IMenuItem[]; 
  load(): IMenuItem[]; 
} 

To some degree, it's like Test-Driven development. We describe the contents of the class without ...

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