PubNub无需用户交互即可发送和接收消息。你需要的是当加载动画栏完成加载时调用的某种函数。当加载条加载完成,调用一个函数像这样:
var UniqueID = PubNub.generateUUID(); //Generate a unique id for user
pubnub.publish(
{
message: {
uuid: UniqueID,
finishedLoading: true
},
channel: 'testChannel',
sendByPost: false, // true to send via posts
});
记住,你必须导入PubNub SDK,并且也有订阅功能。当你创建你的代码来接收消息时,它看起来像这样:
window.listener = {
status: function(statusEvent) {
},
message: function(messageEvent) {
if(messageEvent.message.finishedLoading === true) {
// Run your picture creation and new loading bar creation code here
}
}
pubnub.addListener(listener);
你已经在很多地方发布了这个问题。两次堆栈溢出,这是禁止的。 http://stackoverflow.com/questions/43846374/pubnub-background-processes-for-an-auction-app-development 我认为这就是为什么你的其他职位得到了投票(不是我虽然)。我们也有你的私人支持票。一旦您的问题得到解决/在一个地方得到解答,请帮助我们,并随时随地更新。 –