Jump to content

Passing function to Script Library


Recommended Posts

I have a JXA script library with a single function

 

```

function foo(cb) {

  cb("Hello World")
}
```

 

And I have a JXA script with the following:

```
var mylib = Library("mylib")
mylib.foo(str => console.log(str))
```

But no matter what I do, I get an error that `cb` is not a function but an object. Other datatypes work but I can't seem to pass functions. Is this a limitation or am I holding it wrong?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...