Change DEFAULT NAMES in TogetherJS

450 Views Asked by At

Is there any provision to change the DEFAULT NAMES in TogetherJS? I have seen the DEFAULT NAMES in peers.js.

1

There are 1 best solutions below

1
On BEST ANSWER

In the open source project they are located in the locale files. and compiled into the js file.

You can return your own by creating a script prior to the TogetherJS script file. Works great if you have your own Identity Server.

<script>
  TogetherJSConfig_getUserName = function () {return 'User Name';};
</script>
<script src="https://togetherjs.com/togetherjs-min.js"></script>

You can also create your own random creator simple enough.

Example Fiddle

<script>
  pickRandom = function (array) {
    return array[Math.floor(Math.random() * array.length)];
  };

  var DEFAULT_NICKNAMES = [
    "Mickey Mouse",
    "Donald Duck",
    "Snow White",
    "Sir Goofey",
    "Prince Charming"
  ];

  TogetherJSConfig_getUserName = function () {return pickRandom(DEFAULT_NICKNAMES);};
</script>
<script src="https://togetherjs.com/togetherjs-min.js"></script>

Link to Documents of other settings