Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

constructor callback for wrapped Open in constructor to get err and make async #76

Open
Andrewiski opened this issue May 31, 2016 · 0 comments

Comments

@Andrewiski
Copy link

given the code block below from your source there is no way to pass in a callback to get the Err on the constructor either via options or third param of Callbak

`constructor: (@address, @options = {}) ->
_.defaults @options,
debug: false
device: "/dev/i2c-1"

if @options.debug 
  require('repl').start(
    prompt: "i2c > "
  ).context.wire = @
  process.stdin.emit 'data', '' # trigger repl

process.on 'exit', => @close()

@on 'data', (data) => 
  @history.push data

@on 'error', (err) ->
  console.log "Error: #{error}"

@open @options.device, (err) =>
  unless err then @setAddress @address

`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant