joyride

sashton 2023-04-11T19:23:18.875169Z

I’m looking for a way to pass args to a script, so that I can have two very similar bindings use the same script but have slightly different behavior. I am currently using joyride.runUserScript in my binding. I see an example https://clojurians.slack.com/archives/C03DPCLCV9N/p1651179231629689?thread_ts=1651175929.477879&cid=C03DPCLCV9N of args being passed, but I’m not sure if that was just brainstorming; it doesn’t work for me: The "path" argument must be of type string. Received an instance of Object I thought I’d try joyride.runCode, calling my script with an arg, like:

"args": "(my-script/foo :bar)" 
But that gives me ERROR: Could not resolve symbol: my-script/foo For runCode to work, would I have to first require my script from an activation script? Is there a better way to pass args from the keybinding definition?

sashton 2023-04-11T19:41:23.455729Z

Just as a follow-up, requiring my namespace in user_activate.cljs does allow me to refer to my script in my keybinding, which allows me to specify different args for different keybindings. My question is, is that the correct (only?) solution?

borkdude 2023-04-11T20:24:39.392009Z

You can try to use requiring-resolve

sashton 2023-04-12T13:12:16.691659Z

That works as well. Thanks for the suggestion!