Skip to content

@rupamotion/player/file

Copy as Markdown

@rupamotion/player/file: loads a .rupaplay file and mounts the player on its markup.

  • loadFile(src, options?) resolves to { file } or { error }: never a rejection, never a throw. src is a URL (fetched without credentials to another origin), a Blob, an ArrayBuffer (or a view), a Response, or a file already loaded; options.integrity (sha256-…) is checked before the bytes are read.
  • mountFile(root, src, options?) resolves to { player } or { error }: the file loaded, its CSS and fonts installed (released by the player’s destroy), its markup kept or written (markup), sanitised, then mounted. A failure leaves root as it was (nothing injected, nothing installed, never hidden) and the root sends rupaerror (detail.error, and detail.src: the src given, so a page tells a load it replaced from the one it wants) as well. root not an object is the caller’s TypeError.