edemaine / svgtiler

Tool for drawing diagrams on a grid, combining grids of SVGs into a big SVG figure
MIT License
61 stars 6 forks source link

Sharing state between mapping files to modify their behavior #77

Closed edemaine closed 2 years ago

edemaine commented 2 years ago

I've wanted to be able to define a single mapping file that can be run in a few different modes via configuration flags. A natural way to support this would be:

svgtiler config1.coffee mapping.coffee *.asc
svgtiler config2.coffee mapping.coffee *.asc

But we need some way to pass a message from one mapping (config*.coffee) to the others (mapping.coffee).

Perhaps we can add an implicit share/shared object that's shared among all mapping files, similar to Meteor's coffeescript module.

A workaround for now is to use the svgtiler global. But that seems ugly. (though it may be how to implement this)