showLoading(params: Object)

Requires:
BaseKit≥2.0.1@ray-js/ray≥0.3.23
Platforms:
iOSAndroid
import { showLoading } from '@ray-js/ray';

// Promise usage
try {
  const res = await showLoading({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Show a loading indicator. You must call thing.hideLoading to close it

Parameters

PropertyTypeRequiredDefaultDescription
titlestringYes-Message content
maskbooleanNofalseWhether to show a transparent mask to prevent touch-through
complete() => voidNo-Completion callback (executed on both success and failure)
success() => voidNo-Callback on successful API call
fail(params: Object) => voidNo-Failure callback
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { showLoading } from '@ray-js/ray'

// Show a loading prompt; call hideLoading to close it
showLoading({
  title: "Loading...",
  mask: true,
  success: () => console.log("Loading displayed"),
  fail: error => console.error(error),
});