Class “Resources”

Object > Resources

This is the base class for all typed resource dictionaries. Instances can be obtained from one of its subclasses, or via the build method, which crates an intermediate ResourceBuilder object. All members of a Resources (or subclass) instance must be of the same type (ResourceType).

Type: Resources<ResourceType, RawType>
extends Object
Generics: ResourceType: undefined
RawType: ResourceType
Constructor: protected
Singleton: No
Namespace: tabris
Direct subclasses: ColorResources, FontResources, TextResources
JSX Support: No

Static Methods

build(options)

Generates a ResourceBuilder, which is a factory for resource dictionaries. The options given here determine the type of the resource, as value as the “raw” type from which to create the resource values from.

  • The validator function receives a “raw” resource value (unconverted, as provided in the input data object) and must return a boolean indicating whether it is accepted. This means it either is a value that will be accepted by the converter, or if no converter is present it must be the final format of the resource value.
  • The converter if a function that receives the raw input value and returns the value as it will be present on the final resource dictionary. If no converter is given this is the same type as the resource type.
  • The “type” may be a constructor of the type of the final resource value as returned by the converter. For primitives this option must not be given.
Parameter Type Description
options {
  validator: Function, // optional
  converter: Function, // optional
  type: Function // optional
}
The configuration of the new ResourceBuilder. Requires either a validator or a converter function, or both.

Returns: ResourceBuilder<ResourceType, RawType>