[]
• new UserManager()
表示一个用户管理器。
▸ Static bind(event, handler): void
绑定事件处理程序。
static
example
GC.Spread.Common.UserManager.bind(GC.Spread.Common.Events.CurrentUserChanged, (event, args) => {
console.log(event);
console.log(args.oldCurrentUser);
console.log(args.newCurrentUser);
});
| Name | Type | Description |
|---|---|---|
event |
Events |
事件类型。 |
handler |
Function |
事件处理程序。 |
void
▸ Static configure(options): void
配置用户管理器选项。
static
| Name | Type | Description |
|---|---|---|
options |
IUserManagerOptions |
用户管理器选项。 |
void
▸ Static current(userId?): undefined | string
获取或设置当前用户。
static
example
// 从登录页面导航,并获取登录用户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 | Description |
|---|---|---|
userId? |
string |
当前用户 ID。 |
undefined | string
当前用户 ID。
▸ Static get(userId): Promise<undefined | IUser>
通过用户ID获取用户。
static
| Name | Type | Description |
|---|---|---|
userId |
string |
用户ID。 |
Promise<undefined | IUser>
用户。
▸ Static unbind(event, handler): void
取消绑定事件处理程序。
static
| Name | Type | Description |
|---|---|---|
event |
Events |
事件类型。 |
handler |
Function |
事件处理程序。 |
void