returns the reactive state object of Chat

void getState(object state);


stateobjectstate object


// returns the current state of Chat
const state = $$("ch").getState();

Related samples


The returned state object contains the following properties and methods:

  chatId: 12,
  chatType: "user",
  search: "",
  userId: 87


  • chatId (number) - the id of the chat being viewed currently;
  • userId (number) - the id of the selected user in "users" list / user id in the selected private chat;
  • search (string) - the search value of the active list ( "Chats" or "Users");
  • chatType (string) - the type of the current chat ("chat" or "user"). "chat" is a group chat, "user" is a personal chat.


  • $observe (function) - a handler to listen to changes in the current state of Chat. It takes 2 parameters:
    • prop (string) - a reactive property to listen changes of
    • handler (function) - a function to execute when changes are made. It takes the only argument:
      • value (any) - the current value of the reactive property. The type of the value (string, array, etc) depends on a reactive property being observed.
  • batch (function)- allows to set several properties at once. Takes the only parameter:
    • props (object) - an object containing the pairs of the property name and the value to set.
Back to top