API Docs for:
Show:

LS.Resource Class

Module: LS

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

()

Methods

assignToNode

()

clone

() LS.Resource

Returns:

LS.Resource:

the clone of the resource

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 String

    the new filename

Resource.getDataToStore

(
  • resource
  • allow_blob
)
Object

Static method: Returns an object with a representation of the resource internal data The order to obtain that object is:

  1. checks if getDataToStore function in resource
  2. test for _original_file (File or Blob)
  3. test for _original_data (ArrayBuffer)
  4. toBinary() (ArrayBuffer)
  5. toBlob() (Blob)
  6. toBase64() (String)
  7. serialize() (Object in JSON format)
  8. data property
  9. JSON.stringify(...)

Parameters:

  • resource Object
  • allow_blob Boolean

    [optional]

Returns:

Object:

it has two fields: data and encoding