file-mod

Description

The file-mod manages various file access

Include

initmod

ext = params.ext; $ = params.$; menumod = params.menumod; menu = params.menu; complete = params.complete; source = params.source; focus = params.focus; log = params.log;

the web-editor is setup as the main demo component and as such to simplify the demo's, all options within its initmod are optional

name description
ext the default loader helper
$ the dom helper module
menu | menumod either the main menu or the menumod module
complete an object with keys
load
complete.load, this is called when a file is loaded, the callback is called with parameters
file an object representing the file
blob
a blob, the file data
source a function called when save is called from outside the file-mod itself, it returns a blob of the current file
focus when menu's close, it is sometimes useful for user experience to refocus the active work area, this function is called when that needs to happen
log a reference to global log-mod, in case there is anything that needs to be communicated back to the user, such as file not found, no current file

API

[attribute]

no supported attributes

[module]

name
save ( file )
parameters
file, optional object : file object
no return value
save the current file, the blob is obtained from calling source
clear ()
none
does not return a value
clear the current file
new( filetype,ft, abs,path, name,filename, rel, kind, size, ctime,mtime, title,icon ) alias : newfile
filetype | ft string : represents the filetype abs | path string : holds the file path name | filename string : holds the filename, name is preferred, filename deprecated rel string : holds a relative path kind string : file type size int : holds file size in bytes ctime int : file creation time, unix timestamp mtime int : file modified time, unix timestamp title string : used for a tooltip for the file, usually path+filename icon string : url for file icon, usually data url
file : object, the file object
creates a file object
export
no parameters
object, the exported file object, usually the serialised file object
creates a file object
import
file, object an exported file object
object, file object
imports an exported file object ( not yet implemented )

Examples

Files

latest
v2.0