0

In the following code what those numbers means? I mean, 0, 1 2 and -1. As far I understand if "e.curPerformerInfo.chatType" is FREE or SIMPLE it will call "callExternalWindow" passing "ExternalWindows.WINDOW_INIT_SIMPLE_PRIVATE as argument and ...?

switch (e.curPerformerInfo.chatType) {
    case ChatTypeText.FREE:
    case ChatTypeText.SIMPLE:
        e.callExternalWindow(ExternalWindows.WINDOW_INIT_SIMPLE_PRIVATE, {
            0: function() {
                e.socketCaller.startSimpleChat()
            },
            1: function() {
                e.socketCaller.startPrivateChat()
            },
            2: function() {
                e.socketCaller.startHotConnectionChat()
            }
        }, -1, e.curPerformerInfo.isHotConnectionEnabled);
}
Roger_88
  • 477
  • 8
  • 19
  • 2
    Those have nothing to do with `switch`/`case` syntax, they are parts of the object literal that is passed as an argument to `callExternalWindow` – Bergi May 22 '19 at 21:21

1 Answers1

0

The rest of the code (the function) is just passing an object literal containing methods to e.callExternalWindow, as well as the arguments -1 and e.curPerformerInfo.isHotConnectionEnabled.

Jack Bashford
  • 43,180
  • 11
  • 50
  • 79