Skip to content

Instantly share code, notes, and snippets.

@brakmic
Created March 12, 2017 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brakmic/bf401baeb75af96a626309021fc2cb41 to your computer and use it in GitHub Desktop.
Save brakmic/bf401baeb75af96a626309021fc2cb41 to your computer and use it in GitHub Desktop.
registering vr modules and dispatching messages
public registerModule(): Observable<IServiceMessage> {
return this.asObservable().map((mod) => {
if (!_.isNil(mod) &&
!_.isNil(mod.id) &&
!_.isNil(mod.name)) {
this.store.dispatch( { type: VR_MODULE_ADDED, payload: mod });
return <IServiceMessage> {
id: '0000',
content: `Registered vr module '${mod.name}'`
};
}
return <IServiceMessage>{
id: '000',
content: mod ? `Could not register vr module '${mod.id}'` :
`Could not register unknown vr module`
};
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment