zntg/ui/resources.go
Sander Schobers 67e73a8671 Resources only exposes OpenResource (and Destroy).
PhysicalResources derives from Resources and exposes FetchResource.
Made dependency specific resource addons.
Extended the available resource options (fallback, path, refactored copy).
NewRenderer provides DefaultResources to the created renderer.
2020-05-25 22:24:06 +02:00

20 lines
684 B
Go

package ui
import "io"
// Resources is an abstraction for opening resources.
type Resources interface {
// OpenResource should open the resource with the specified name. The user is responsible for closing the resource.
OpenResource(name string) (io.ReadCloser, error)
// Destroy can be used for cleaning up at the end of the applications lifetime.
Destroy() error
}
// PhysicalResources is an abstraction for opening and fetching (to disk) resources.
type PhysicalResources interface {
Resources
// FetchResource should fetch the resource with the specified name and return a path (on disk) where the resource can be accessed.
FetchResource(name string) (string, error)
}