brandonhorst/node-osa

can't access Application object

Closed this issue · 1 comments

I have osa(() => { Application('iTunes').pause() })
and I get ReferenceError: Application is not defined.

So the problem is that you're not passing a callback. v2.4.0 requires a callback to be passed as the final argument.

I just released v2.5.0 which does not have this limitation. You can call function without a callback and it should work fine. Of course, you will never know if an error occurs, so it's probably not a good idea... but I'm not one to judge.

Just change your code to

osa(() => {
  Application('iTunes').pause()
}, (err) => {
  if (err) console.error(err)
})

and it will work on either version.