osso.Autosave
The LibOSSO Autosave object.
Constructor
Creates a new osso.AutoSave
based on the osso.Context object.
osso.AutoSave(context)
|
|
---|---|
context |
The OSSO Context object related to the application. |
Returns | An autosaving object to use in later calls to this library. None is returned if an error happened. |
How to use autosave:
The application registers callback function(s) that is/are called by LibOSSO to save the user
data (such as an unsaved document). Whenever the user data changes, the application calls
osso.Autosave.userdata_changed()
to tell LibOSSO that the callback(s) should be
called in the future.
LibOSSO will call the callback(s) when:
- A "dirty data" timer in Libosso expires.
- LibOSSO gets a message from the system that unsaved user data should be saved (e.g. at shutdown).
The application should call osso.Autosave.force_autosave()
whenever it is switched to the
background (untopped).
After the autosave callbacks have been called, the timer inside LibOSSO is reset and the application
needs to call osso.Autosave.userdata_changed()
again when it has new "dirty" user data.
set_autosave_callback
This method registers an autosave callback function.
osso.Autosave.set_autosave_callback(callback, user_data = None)
|
|
---|---|
callback |
The callback function. |
user_data (optional) |
Arbitrary application specific object that will be passed to the callback and ignored by LibOSSO. |
userdata_changed
This method is called by the application when the user data has been changed, so that LibOSSO knows that a call to the autosave callback is needed in the future to save the user data. The dirty state will be cleared every time the application's autosave callback function is called.
osso.Autosave.userdata_changed()
|
---|
force_autosave
This method forces a call to the application's autosave function, and resets the autosave timeout. The application should call this method whenever it is switched to background (untopped).
osso.Autosave.force_autosave()
|
---|
get_name
Returns the application name.
osso.Autosave.get_name()
|
|
---|---|
Returns | Application's name. |
get_version
Returns the application version.
osso.Autosave.get_version()
|
|
---|---|
Returns | Application's version. |
Improve this page