Usage
Signature:
interface RefresherElement
Typescript Import Format
//To typecheck the element APIs, import as below.
import { RefresherElement } from "ojs/ojrefresher";
//For the transpiled javascript to load the element's module, import as below
import "ojs/ojrefresher";
For additional information visit:
Note: Application logic should not interact with the component's properties or invoke its methods until the BusyContext indicates that the component is ready for interaction.
Styling Classes
-
.oj-scroller
-
Designates the element to be the scroller element used in place of the target.
Example
<oj-refresher id='myrefresher' threshold='100' text='Checking for updates' refresh-content='[[refreshFunc]]'> <oj-list-view id="refreshId"></oj-list-view> </oj-refresher>
-
CSS Variables
Name | Type | Description |
---|---|---|
--oj-refresher-bg-color |
<color> | Refresher background color |
Attributes
-
refresh-content :function(): Promise.<*>
-
The function to invoke when the pull to refresh is triggered. Must return a Promise which will be resolved when the refresh function is completed.
- Default Value:
null
Names
Item Name Property refreshContent
Property change event refreshContentChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-refresh-content-changed
-
target :Element
-
The target to detect pull down. If no target is specified, then the wrapper will attempt to use the first child element with the 'oj-scroller' CSS style class applied to it. If no such element is found, then the first child element of the oj-refresher element will be used.
- Default Value:
null
Names
Item Name Property target
Property change event targetChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-target-changed
-
text :string
-
A text messsage shown in the pull-to-refresh panel after a pull down gesture.
- Default Value:
''
Names
Item Name Property text
Property change event textChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-text-changed
-
threshold :number
-
The minimum distance in pixels that the user needs to pull down in order to trigger a refresh. If 0, then the threshold will default to the height of the target element.
- Default Value:
0
Names
Item Name Property threshold
Property change event thresholdChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-threshold-changed
-
translations :object|null
-
A collection of translated resources from the translation bundle, or
null
if this component has no resources. Resources may be accessed and overridden individually or collectively, as seen in the examples.If the component does not contain any translatable resource, the default value of this attribute will be
null
. If not, an object containing all resources relevant to the component.If this component has translations, their documentation immediately follows this doc entry.
Names
Item Name Property translations
Property change event translationsChanged
Property change listener attribute (must be of type function, see Events and Listeners for additional information.) on-translations-changed
-
(nullable) translations.aria-refresh-complete-link :string
-
Label assigned to the refresh message to denote refresh complete that appears after triggering refresh content.
- Default Value:
"Refresh complete"
- Since:
- 5.1.0
Names
Item Name Property translations.ariaRefreshCompleteLink
-
(nullable) translations.aria-refresh-link :string
-
Label assigned to the refresh link used for triggering refresh content when using keyboard or accessibility agents such as VoiceOver.
- Default Value:
"Activate link to refresh content"
- Since:
- 5.1.0
Names
Item Name Property translations.ariaRefreshLink
-
(nullable) translations.aria-refreshing-link :string
-
Label assigned to the refresh message to denote that the refresh is occurring that appears after triggering refresh content.
- Default Value:
"Refreshing content"
- Since:
- 5.1.0
Names
Item Name Property translations.ariaRefreshingLink
Methods
-
getProperty(property) : {any}
-
Retrieves the value of a property or a subproperty. The return type will be the same as the type of the property as specified in this API document. If the method is invoked with an incorrect property/subproperty name, it returns undefined.
Parameters:
Name Type Description property
string The property name to get. Supports dot notation for subproperty access. - Since:
- 4.0.0
Returns:
- Type
- any
Example
let subpropValue = myComponent.getProperty('complexProperty.subProperty1.subProperty2');
-
refresh : {void}
-
Refreshes the component.
Returns:
- Type
- void
-
setProperties(properties) : {void}
-
Performs a batch set of properties. The type of value for each property being set must match the type of the property as specified in this API document.
Parameters:
Name Type Description properties
Object An object containing the property and value pairs to set. - Since:
- 4.0.0
Returns:
- Type
- void
Example
myComponent.setProperties({"prop1": "value1", "prop2.subprop": "value2", "prop3": "value3"});
-
setProperty(property, value) : {void}
-
Sets a property or a subproperty (of a complex property) and notifies the component of the change, triggering a [property]Changed event. The value should be of the same type as the type of the attribute mentioned in this API document.
Parameters:
Name Type Description property
string The property name to set. Supports dot notation for subproperty access. value
any The new value to set the property to. - Since:
- 4.0.0
Returns:
- Type
- void
Example
myComponent.setProperty('complexProperty.subProperty1.subProperty2', "someValue");