continue connloop;抛出Syntax Error: Unsyntactic continue。
如果我将continue connloop;更改为continue;,它将运行(但它当然不会在外部循环上执行,而是在内部循环上执行)
为什么会发生这种情况,这在nodejs/ecma6中是不推荐的还是非法的?
请不要建议我使用函数调用而不是标签。
redisSubscriber.on("message", function(channel, event){
event = JSON.parse(event);
const eventPayload = JSON.stringify(event.payload);
connloop:
for(let conn in connections){
conn = connections[conn];
redisClient.SMEMBERS('connection/'+conn.id+'/subscriptions', (err, subscriptions)=>{
let intersectedTags = [];
if(event.address.tags.length > 0 && subscriptions.length > 0){
for(let tag in subscriptions){
tag = subscriptions[tag];
for(let _tag in event.address.tags){
_tag = event.address.tags[_tag];
if(tag == _tag)
intersectedTags.push(tag);
}
}
}
let exclusive = false;
for(let userId in event.address.include){
userId = event.address.include[userId];
if(userId == conn.userId){
exclusive = true;
break;
}
}
if(intersectedTags.length > 0 || exclusive){
if(event.address.exclude){
for(let exclude in event.address.exclude){
exclude = event.address.exclude[exclude];
if(exclude == conn.userId){
continue connloop;
}
}
}
const browserEvent = {tags: intersectedTags, notification: eventPayload, exclusive};
conn.write(JSON.stringify(browserEvent));
}
})
} });https://stackoverflow.com/questions/41293984
复制相似问题