continue connloop;
スローSyntax Error: Unsyntactic continue
。ラベル付きcontinue文。 forループ
私はcontinue;
からcontinue connloop;
を変更すると、それが実行されます(しかし、ofcourseのそれは外側のループではなく、内側1に実行されません)
なぜこの出来事が、これは非推奨または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));
}
})
} });