Replies: 2 comments 5 replies
-
I think it would make sense if extensions can export a "JS library" that can be required from joyride, like any other JS library in the Electron runtime. (require '["betterthantomorrow.calva$v0" :as calva])
(calva/evaluateCode ...) This reduces boilerplate but also makes it unambiguous from which extension the function is being used. The I think it makes sense to have these functions as compiled JS rather than code that should be interpreted, although both may have their use cases.
|
Beta Was this translation helpful? Give feedback.
-
For Joyride libraries like the OP suggests we could also do something similar to Calva's drams, and use a repository for it. Then it would be more convenient to crowd source common functions, wether they pertain to specific extensions or compositions of extensions, or no extensions. |
Beta Was this translation helpful? Give feedback.
-
To make their extensions API:s more convenient for Joyride users, what if an extension could provide library namespaces to Joyride somehow. If we use Calva's current single API function as an example, we today need to do this to use it and have it print output and errors to the Joyride output channel:
Then we can use it:
With a Calva joyride library provided that it could be cut down to something like:
(It could be argued that a
(require '[calva.core :as calva])
would make this a bit more explicit and transparent.)There are several ways this could be surfaced to the Joyride user. One is that Joyride looks in the folder of active extensions for a
joyride
directory and adds any such a libraries to its ”classpath”. If Calva had something likejoyride/core.cljs
in its extension folder, containing this:The namespace
betterthantomorrow.calva.core
would be made available to joyride scripts. And the use could look simply like so:And
joyride/paredit.cljs
would be reached atbetterthantomorrow.calva.paredit
, and so on and so forth.Since Joyride is available for these libraries, the code in them can parse EDN and whatever Clojure-y things that Joyride scripts themselves can do.
Beta Was this translation helpful? Give feedback.
All reactions