View Source DevJoy.Scene.Asset (DevJoy v1.0.0)

Asset gives a way to display an image, play a sound or work with any other files. Data allows to configure how the asset should be used. For example the same image may be displayed as a background or inside an image preview popup. The sounds on the other side could be repeated. Other files or even directories could be used to show a gallery or open it in external application.

Example

defmodule MyApp.SceneWithAsset do
  use DevJoy.Scene

  part :asset do
    asset "/path/to/asset", some: :data
  end
end

Summary

Types

Additional data

Relative path to file

t()

Asset struct

Functions

Returns absolute path for asset

Types

@type data() :: Keyword.t()

Additional data

@type path() :: String.t()

Relative path to file

@type t() :: %DevJoy.Scene.Asset{data: data(), path: path()}

Asset struct

Functions

Link to this function

priv_path(asset, otp_app)

View Source
@spec priv_path(t(), otp_app :: atom()) :: String.t()

Returns absolute path for asset

Link to this function

static_path(asset, base_path_or_endpoint_or_uri \\ nil)

View Source
@spec static_path(t(), base_path | endpoint | uri | nil) :: String.t()
when base_path: String.t(), endpoint: module(), uri: URI.t()

Returns static path for asset