In my case, I’m animating certain elements of the SVG code using JavaScript. But since the SVG code is loaded after the page load has finished, my animation script is failing, as there is no code present to animate (yet) when it fires.
So, it would be useful if I could specify a callback function(s) that would be fired at the ‘complete’ event of the get request for the SVG code.
I could see two ways to do it:
1) A ‘global’ function to call, which would receive each given SVG as an argument. This could be an option of the plugin. Just a simple text field that would store a function name, which would then be called, passing each returned SVG as it’s main argument each time it’s called. This would be useful if, say, I knew that ALL my animations were going to need to fire an “animateSVG” function.
2) SVG-specific function names. This could perhaps be assigned PER SVG. Somehow at the point of insertion/selection of the SVG image in the WP editor, a function name could be supplied by the user. This would then be stored as a data-callback-XXX attribute on the rendered SVG root node. Then the SVG Support script would search the DOM at the onComplete for elements that had a data-callback- prefix and fire their corresponding functions, again, passing the SVG element as an argument to the specified function.
Those are just how I saw it happening. I’m sure there are many ways you could do it.
Thanks for the reply and for considering the feature addition.
best,
Ben