3 Autosave

▼ |  | Framework: Racket GUI Application Framework

1 | Framework Libraries Overview
2 | Application
3 | Autosave
4 | Canvas
5 | Color Model
6 | Color Prefs
7 | Color
8 | Comment Box
9 | Decorated Editor Snip
10 | Editor Snip
11 | Editor
12 | Exit
13 | Finder
14 | Frame
15 | Group
16 | GUI Utilities
17 | Handler
18 | Icon
19 | Keymap
20 | Menu
21 | Mode
22 | Notify-boxes
23 | Number Snip
24 | Panel
25 | Pasteboard
26 | Path Utils
27 | Preferences
28 | Preferences, Textual
29 | Racket
30 | Srcloc Snips
31 | Text
32 | Splash
33 | Test
34 | Version
35 | Backwards Compatibility
36 | Signatures
37 | Unit
| Index

On this page:

autosave: autosavable<%>
do-autosave
autosave: register
autosave: current-toc-path
autosave: toc-path
autosave: restore-autosave-files/ gui

Racket
top contents ← prev up next →

## 3 Autosave🔗ℹ

interface autosave:autosavable<%> : interface?

Classes that implement this interface can be autosaved.

> > method (send an-autosave:autosavable do-autosave) → void?

> This method is called when the object is registered to be autosaved (see autosave:register).

> procedure (autosave:register obj) → void?
> | obj |  | : |  |
> (and/c (is-a?/c autosave:autosavable<%>)
> (is-a?/c editor<%>))

Adds obj to the list of objects to be autosaved. When it is time to autosave, the do-autosave method of the object is called. This method is responsible for performing the autosave.

There is no need to de-register an object because the autosaver keeps a weak reference to the object; i.e., the autosaver does not keep an object from garbage collection.

> value autosave:current-toc-path : (make-parameter path?)

The path to the a table-of-contents file for the autosave files.

The parameter is inspected only when the autosave timer expires, which will not happen until after the first call to autosave:register

> value autosave:toc-path : path?

The default value of the parameter autosave:current-toc-path, and the path to the autosave that DrRacket uses.

> procedure (autosave:restore-autosave-files/gui [table]) → void?
> | table |  | : |  | (or/c #f (listof (list/c (or/c #f absolute-path?) absolute-path?)))
> |  |  | = |  | #f

Opens a GUI to ask the user about recovering any autosave files left around from crashes or other catastrophic failures.

If table is not supplied, then the file in autosave:current-toc-path is consulted to find the files to restore. If it is supplied, then it is used to find the files to recover. Each inner list names the original file and the autosave file. If the original file was never saved, then the first element of the list is #f.

This function doesn’t return until the user has finished restoring the autosave files. It uses yield to handle events, however.)

top contents ← prev up next →