FFOSBR API - dcobbley/capstone-e GitHub Wiki

FFOSBR API

Backup module

FFOSBR.backup(type, oncomplete)

Saves specified file type to external storage device. Callback is invoked upon completion. If an error occurred, it will be passed as the first parameter to the callback, "oncomplete".

Clean module

FFOSBR.clean(type, oncomplete)

Deletes specified file types from external storage device. Callback is invoked upon completion. If an error occurred, it will be passed as the first parameter to the callback, "oncomplete".

History module

FFOSBR.History.getDefault()

WIP

FFOSBR.History.loadHistory()

WIP

FFOSBR.History.get(field, subfield)

WIP

FFOSBR.History.validateAll(potentialHistoryObject)

WIP

FFOSBR.History.validateEntry(potentialHistoryEntry)

WIP

FFOSBR.History.validateEntryField(field, value)

WIP

FFOSBR.History.set(fieldNameOrHistoryObject, historyValue)

WIP

FFOSBR.History.get(field, subfield)

WIP

Storage module

FFOSBR.Storage.fileExists(fname, oncomplete)

Reports whether or not a file exists in a given storage.

FFOSBR.Storage.populate()

Enumerates all files on storage and adds them to the "files" object. This is used for tracking what files exist in the storage at all times.

FFOSBR.Storage.sanitizeFilename(fname)

Sanitizes file names such that they are valid object keys.

Media module

FFOSBR.Media.getInternalStorage(stores)

Takes an array of DeviceStorage objects and returns whichever represents the internal storage.

FFOSBR.Media.getExternalStorage(stores)

Takes an array of DeviceStorage objects and returns whichever represents the external storage.

Messages module

FFOSBR.Messages.backup(callback)

Backups the current SMS and MMS messages on the device to external storage. Callback is invoked upon completion. If an error occurred, it will be passed as the first parameter to the callback.

FFOSBR.Messages.restore(callback)

Firefox OS current exposes no API to restore messages to the device so this function is a noop.

FFOSBR.Messages.clean(callback)

Deletes the messages file from external storage. Callback is invoked upon completion. If an error occurred, it will be passed as the first parameter to the callback.

FFOSBR.Messages._getMessages(callback)

Retrieves the current messages from the device. Callback is invoked upon completion. If an error occurred, it will be passed as the first parameter to the callback. If no error occured then the a list of messages will be passed to the callback.

FFOSBR.Messages._putMessagesOnSD(messageData, callback)

Stores the pasted in messages to external storage. Callback is invoked upon completion. If an error occurred, it will be passed as the first parameter to the callback.

Restore module

FFOSBR.restore(onerror)

Writes files stored in a Ffosbr backup back to Firefox OS. The contents restored depends on the backup present. Valid data types are: apps, music, photos, videos, contacts, and settings. If an error occurs, restore tries to call the "onerror" handler.

Settings module

FFOSBR.Settings.load()

WIP

FFOSBR.Settings.getBackupDirectoryPaths()

WIP

FFOSBR.Settings.validate()

WIP

FFOSBR.Settings.set(newOptions, value)

WIP

FFOSBR.Settings.get(field)

WIP

Utilities module

FFOSBR.Utilities.isFunction(functionToCheck)

Determines whether an object is a function.

FFOSBR.Utilities.contactToVcard(inContact)

WIP