Created
August 15, 2019 21:32
-
-
Save icirellik/0c00fbf08c7280a24b364d4b9a03aeb6 to your computer and use it in GitHub Desktop.
Remoting Runtime Psuedo code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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