Class Groups

The Groups class represent all groups defined in the KLF-200.

Groups

Properties

Connection: IConnection
Groups: Group[] = []

Contains a list of groups. The index of each group corresponds to the group ID.

groupType: GroupType = GroupType.UserGroup

Methods

  • Finds a group by its name and returns the group object.

    Parameters

    • groupName: string

      The name of the group.

    Returns undefined | Group

    Returns the group object if found, otherwise undefined.

  • Adds a handler that will be called if a new group is added to the KLF-200 interface or a group has been changed.

    Parameters

    • handler: Listener<number>

      Event handler that is called if a new group is added or a group has been changed.

    Returns Disposable

    The event handler can be removed by using the dispose method of the returned object.

  • Adds a handler that will be called if a group is removed from the KLF-200 interface.

    Parameters

    • handler: Listener<number>

      Event handler that is called if a group is removed.

    Returns Disposable

    The event handler can be removed by using the dispose method of the returned object.

  • Creates a new instance of the Groups class. During the initialization phase of the class a list of all groups will be retrieved from the KLF-200 interface and stored at the Groups array.

    Additionally, some notification handlers will be instantiated to watch for changes to the groups.

    Parameters

    • Connection: IConnection

      The connection object that handles the communication to the KLF interface.

    • OptionalgroupType: GroupType = GroupType.UserGroup

      The group type for which the groups should be read. Default is GroupType.UserGroup.

    Returns Promise<Groups>

    Resolves to a new instance of the Groups class.