[]
• new UserManager()
Represent a user manager.
▸ Static bind(event, handler): void
Bind an event handler.
static
example
const users = spread.users;
users.bind(GC.Spread.Common.Events.CurrentUserChanged, (event, args) => {
console.log(event);
console.log(args.oldCurrentUser);
console.log(args.newCurrentUser);
});
| Name | Type | Description |
|---|---|---|
event |
Events |
Event type. |
handler |
Function |
Event handler. |
void
▸ Static configure(options): void
Configure the user manager options.
static
| Name | Type | Description |
|---|---|---|
options |
IUserManagerOptions |
The user manager options. |
void
▸ Static current(userId?): undefined | string
Get or set the current user.
static
example
// navigate from the login page, and get the login user id
spread.users.current('715CFB19-2BB9-4B94-BE0C-08D0F9A019D4'); // { id: "715CFB19-2BB9-4B94-BE0C-08D0F9A019D4", name: "John Doe" }
console.log(spread.users.getSync(spread.users.current()).name); // "John Doe"
| Name | Type |
|---|---|
userId? |
string |
undefined | string
The current user id.
▸ Static get(userId): Promise<undefined | IUser>
Get a user by user id.
static
| Name | Type | Description |
|---|---|---|
userId |
string |
The user id. |
Promise<undefined | IUser>
The user.
▸ Static unbind(event, handler): void
Unbind an event handler.
static
| Name | Type | Description |
|---|---|---|
event |
Events |
Event type. |
handler |
Function |
Event handler. |
void