Re: ReSpec: Performing some actions before saving a snapshot

On 20/08/2014 19:31 , Shane McCarron wrote:
> In the PFWG editor's meeting today, one editor noted that in some
> situations (with some dynamic documents) it would be nice to ensure that
> any dynamic aspects of the document are set to their default state
> before saving the snapshot.  I thought I remembered there was a way to
> basically register a ReSpec event handler for the save event so that you
> could do this sort of processing.  Is there a way to do that, or did I
> dream it?

There is currently no event for save. There are two features that can 
help you, though I am unsure if they're enough for your needs:

   • Anything with a class of removeOnSave gets removed on save.

   • When the processing is finished, an end-all event is dispatched.

The former would work for instance if you have some scripts that are 
dynamically inserting elements. You could have them label their elements 
with that class.

The latter would work only if said scripts run before ReSpec is done and 
don't do anything afterwards.

It would be fairly easy to add a save event that ui/save-html.js could 
dispatch.

-- 
Robin Berjon - http://berjon.com/ - @robinberjon

Received on Tuesday, 16 September 2014 10:42:27 UTC