Skip to content

Instantly share code, notes, and snippets.

@icirellik
Created August 15, 2019 21:32
Show Gist options
  • Save icirellik/0c00fbf08c7280a24b364d4b9a03aeb6 to your computer and use it in GitHub Desktop.
Save icirellik/0c00fbf08c7280a24b364d4b9a03aeb6 to your computer and use it in GitHub Desktop.
Remoting Runtime Psuedo code
type Libraries = any;
type Remoting = any;
export interface LibrariesViewModel {
list(): Libraries[];
}
class LibrariesImpl implements LibrariesViewModel {
public list(): Libraries[] {
return [
'lib1',
'lib2',
];
}
}
class LibrariesRemoteImpl implements LibrariesViewModel {
constructor(
private baseLibraries: LibrariesViewModel,
private remoting: Remoting
) { }
public list(): Libraries[] {
const remote = this.remoting.getRemoteLibraries();
return [
...remote,
...this.baseLibraries.list(),
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment