Last active
February 26, 2020 10:19
-
-
Save jwulf/269745c95b98c0308b95c472066c24c0 to your computer and use it in GitHub Desktop.
Example code from the article https://www.joshwulf.com/blog/2020/02/shun-the-mutant/
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
const GRPCConnection = url => { | |
let connected = false | |
const _connection = gRPC(url) | |
_connection.on('connect', () => (connected = true)) | |
_connection.on('disconnect', () => (connected = false)) | |
return { | |
getIsConnected(): connected, | |
connect: () => connected || _connection.connect() | |
send: command => _connection.send(command) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment