在3.1中分发的Javascript cometd聊天客户端中有一行我不明白

时间:2016-12-20 12:05:52

标签: javascript cometd

我的问题是关于chat.js中的_metaConnect函数。这是功能:

   function _metaConnect(message) {
        if (!$scope.joined) {
            $scope.connected = false;
            _connectionClosed();
        } else {
            var wasConnected = $scope.connected;
            $scope.connected = message.successful === true;
            if (!wasConnected && $scope.connected) {
                _connectionEstablished();
            } else if (wasConnected && !$scope.connected) {
                _connectionBroken();
            }
        }
    }

具体来说,该行是什么

$scope.connected = message.successful === true; 

完成?

1 个答案:

答案 0 :(得分:1)

$scope.connected获取message.successful === true的值。

如果message.successful === true的值为message.successful,则

true的值为true;如果message.successful具有任何其他值,则值为false。