JS modules in scripting automations

Topic Labels: Scripting extentions
1179 1
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

Just want to put in a vote for some kind of “import” functionality or js module support for sharing code between automations. I’m resisting the temptation to create a “Modules” table and eval’ing those records into each of my scripts. Please, save me from myself.

1 Reply 1

Eval is not inherently bad. I’d argue no part of the spec is. But there are usually better ways to achieve similar functionality with less overhead and/or risk. Plus, having code split acros an n number of fields is just step one. Now you need a way to maintain, update, ditch, and reintroduce it on the fly. Otherwise you’re just working with a handicapped version of Git.

I’ve actually been trying to solve some of these exact problems as a hobby project for the past year. As luck would have it, I literally just finished outlining my progress over here. Planning to open-source a working system this month, but primarily as a curiosity. If you’re really super cereal about systemic maintenance of your scripts, the only tried and tested option I know of is on2Air. Its creator is a frequent poster on these boards, maybe ping him for more info if you’re unsure whether your use case is a good fit. I never used the service personally but I can see they also offer a trial, plus it’s been around for a while and the only odd complaing you can find is from the people who never used it being unhappy with the pricing. I take that to mean the majority of existing users are happy with their money’s worth. Or the platform just hasn’t gotten big enough to attract hate yet. :joy: