LS.Resource Class
This class contains all the info about a resource and it works as a template for any resource class Keep in mind that there are many resource classes like Meshes or Textures that DONT INHERIT FROM THIS CLASS. This class is used mainly to generic file resources like text files (scripts, csvs, etc)
Constructor
LS.Resource
()
Item Index
Methods
assignToNode
()
getAsHTML
()
HTMLElement
Returns:
HTMLElement:
the root HTMLElement that contains the code
getAsSubfiles
()
Object
Returns:
Object:
the object that contains every subfile
getCategory
()
hasEditableText
()
rename
()
rename
(
-
new_filename
Parameters:
-
new_filename
Stringthe new filename
Resource.getDataToStore
(
Object
-
resource
-
allow_blob
Static method: Returns an object with a representation of the resource internal data The order to obtain that object is:
- checks if getDataToStore function in resource
- test for _original_file (File or Blob)
- test for _original_data (ArrayBuffer)
- toBinary() (ArrayBuffer)
- toBlob() (Blob)
- toBase64() (String)
- serialize() (Object in JSON format)
- data property
- JSON.stringify(...)
Parameters:
-
resource
Object -
allow_blob
Boolean[optional]
Returns:
Object:
it has two fields: data and encoding