Ibm mobilefirst 是否可以更新WL.BusyIndicator中的文本消息?
在我开始一个长时间运行的进程之前,我通过这段代码创建了一个新的WL.BusyIndicatorIbm mobilefirst 是否可以更新WL.BusyIndicator中的文本消息?,ibm-mobilefirst,worklight-studio,worklight-runtime,Ibm Mobilefirst,Worklight Studio,Worklight Runtime,在我开始一个长时间运行的进程之前,我通过这段代码创建了一个新的WL.BusyIndicator if (gblShowBusyIndicator) { busyIndicator = new WL.BusyIndicator('loader', {text: 'Refreshing local sales data...', opacity: 0.85, fullScreen: true}); busyIndicator.show
if (gblShowBusyIndicator) {
busyIndicator = new WL.BusyIndicator('loader',
{text: 'Refreshing local sales data...',
opacity: 0.85,
fullScreen: true});
busyIndicator.show();
}
在该过程中是否可能间歇更新“text”参数?我试着调用这个函数,但没有成功。有什么想法吗
function setBusyIndicatorStatus(status) {
try {
if (busyIndicator.isVisible()) {
busyIndicator({text: status});
}
} catch (e) {
if (gblLoggerOn) WL.Logger.debug(">> setBusyIndicatorStatus(" + status + ") failure... discarding");
}
}
经过一些额外的思考,下面是我如何解决这个问题的,但我想知道是否有比在代码中的某些点切换显示/隐藏不同状态消息更好的方法 谢谢
function setBusyIndicatorStatus(view, status) {
if (gblLoggerOn) WL.Logger.debug(">> setBusyIndicatorStatus(" + view + ", " + status + ")");
try {
if (busyIndicator.isVisible()) busyIndicator.hide();
} catch (e) {
if (gblLoggerOn) WL.Logger.debug(">> setBusyIndicatorStatus(" + view + ", " + status + ") failure... discarding");
}
busyIndicator = null;
var options = {text: null, opacity: 0.85, fullScreen: true};
options.text = status;
busyIndicator = new WL.BusyIndicator(view, options);
busyIndicator.show();
}