KUMobile

API Docs for: 0.0.2

KUMobile.FileIO

Module: KUMobile

Local file control used to make saving and reading files MUCH easier then the plugin allows for.

clear

() private

Triggered any time a failure occurs

Example:

// Clear file data
KUMobile.FileIO.clear();

fail

() private

Triggered any time a failure occurs

read_GotFile

() private

Triggered after file is retrieved

read_GotFileEntry

() private

Triggered after file entry is retrieved

read_GotFS

() private

Triggered after file system is retrieved

read_ReadAsText

() private

Triggered after file is ready to be read from

readFromFile

(
  • name
  • success
  • failure
)

Reads contents from file with proper callbacks.

Parameters:

Name Type Description
name String
  • file name to read from
success Function
  • callback for successful writing
failure Function
  • callback for failure of writing

Example:

var success = function(result){
    ...
};
var fail = function(errorcode){
    ...
};

// Read from file
KUMobile.FileIO.readFromFile("TestAppKUMobile.txt", success, fail);

write_GotFileEntry

() private

Triggered after file entry is ready

write_GotFileWriter

() private

Triggered after file writer is ready

write_GotFS

() private

Triggered after file system is ready

writeToFile

(
  • name
  • content
  • success
  • failure
)

Writes contents to file with proper callbacks.

Parameters:

Name Type Description
name String
  • file name to save to
content String
  • what we want to save (usually JSON string)
success Function
  • callback for successful writing
failure Function
  • callback for failure of writing

Example:

var success = function(){
     ...
};
var fail = function(error){
     ...
};

// Save to file
KUMobile.FileIO.writeToFile("TestAppKUMobile.txt", "Secret Message!", success, fail);

debug

boolean

Enables debug messages via alert messages. Do NOT enable this unless there are legitimate problems with plugins (not available to debug via browser).

Default: false

failCallback

Function private

Method to callback on any failure

fileContents

string private

Contents of current file (the entire point of reading)

fileName

string private

Name of the current file.

successCallback

Function private

Method to callback on complete success.