Skip to content

Instantly share code, notes, and snippets.

@ypcode
Last active July 7, 2017 07:56
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 ypcode/ba786ab990007c7bbeeb5e8bb4fa3bdc to your computer and use it in GitHub Desktop.
Save ypcode/ba786ab990007c7bbeeb5e8bb4fa3bdc to your computer and use it in GitHub Desktop.
//...
private executeOrDelayUntilAuthenticated(action: Function): void {
if (this.authenticated) {
action();
} else {
setTimeout(() => {
this.executeOrDelayUntilAuthenticated(action);
}, 1000);
}
}
private submitRequest() {
this.executeOrDelayUntilAuthenticated(() => {
let service = new HardwareRequestProxyService(this.props.httpClient);
service.submitRequest(this.currentRequest);
});
}
//...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment