mirror of
https://gitee.com/openharmony/interface_sdk-js
synced 2024-10-07 06:03:30 +00:00
!9574 add switch event on/off
Merge pull request !9574 from jidong/getLocalId022801
This commit is contained in:
commit
881829ab28
98
api/@ohos.account.osAccount.d.ts
vendored
98
api/@ohos.account.osAccount.d.ts
vendored
@ -1705,6 +1705,74 @@ declare namespace osAccount {
|
||||
*/
|
||||
off(type: 'activate' | 'activating', name: string, callback?: Callback<number>): void;
|
||||
|
||||
/**
|
||||
* Subscribes to the OS account switching event.
|
||||
*
|
||||
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
|
||||
* @param { 'switching' } type - Indicates the event type.
|
||||
* @param { Callback<OsAccountSwitchEventData> } callback - Indicates the callback for getting the event data.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Not system application.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
* @throws { BusinessError } 12300001 - System service exception.
|
||||
* @throws { BusinessError } 12300002 - Invalid type.
|
||||
* @syscap SystemCapability.Account.OsAccount
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 12
|
||||
*/
|
||||
on(type: 'switching', callback: Callback<OsAccountSwitchEventData>): void;
|
||||
|
||||
/**
|
||||
* Unsubscribes from the OS account switching event.
|
||||
*
|
||||
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
|
||||
* @param { 'switching' } type - Indicates the event type.
|
||||
* @param { Callback<OsAccountSwitchEventData> } [callback] - Indicates the callback for getting the event data.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Not system application.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
* @throws { BusinessError } 12300001 - System service exception.
|
||||
* @throws { BusinessError } 12300002 - Invalid type.
|
||||
* @syscap SystemCapability.Account.OsAccount
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 12
|
||||
*/
|
||||
off(type: 'switching', callback?: Callback<OsAccountSwitchEventData>): void;
|
||||
|
||||
/**
|
||||
* Subscribes to the OS account switched event.
|
||||
*
|
||||
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
|
||||
* @param { 'switched' } type - Indicates the event type.
|
||||
* @param { Callback<OsAccountSwitchEventData> } callback - Indicates the callback for getting the event data.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Not system application.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
* @throws { BusinessError } 12300001 - System service exception.
|
||||
* @throws { BusinessError } 12300002 - Invalid type.
|
||||
* @syscap SystemCapability.Account.OsAccount
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 12
|
||||
*/
|
||||
on(type: 'switched', callback: Callback<OsAccountSwitchEventData>): void;
|
||||
|
||||
/**
|
||||
* Unsubscribes from the OS account switched event.
|
||||
*
|
||||
* @permission ohos.permission.MANAGE_LOCAL_ACCOUNTS
|
||||
* @param { 'switched' } type - Indicates the event type.
|
||||
* @param { Callback<OsAccountSwitchEventData> } [callback] - Indicates the callback for getting the event data.
|
||||
* @throws { BusinessError } 201 - Permission denied.
|
||||
* @throws { BusinessError } 202 - Not system application.
|
||||
* @throws { BusinessError } 401 - The parameter check failed.
|
||||
* @throws { BusinessError } 12300001 - System service exception.
|
||||
* @throws { BusinessError } 12300002 - Invalid type.
|
||||
* @syscap SystemCapability.Account.OsAccount
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 12
|
||||
*/
|
||||
off(type: 'switched', callback?: Callback<OsAccountSwitchEventData>): void;
|
||||
|
||||
/**
|
||||
* Gets the bundle ID associated with the specified UID.
|
||||
*
|
||||
@ -1983,6 +2051,36 @@ declare namespace osAccount {
|
||||
domainInfo: DomainAccountInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Defines the switching/switched event data structure for the OS account.
|
||||
*
|
||||
* @typedef OsAccountSwitchEventData
|
||||
* @syscap SystemCapability.Account.OsAccount
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 12
|
||||
*/
|
||||
interface OsAccountSwitchEventData {
|
||||
/**
|
||||
* Indicates which OS account to switch from.
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.Account.OsAccount
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 12
|
||||
*/
|
||||
fromAccountId: number;
|
||||
|
||||
/**
|
||||
* Indicates which OS account to switch to.
|
||||
*
|
||||
* @type { number }
|
||||
* @syscap SystemCapability.Account.OsAccount
|
||||
* @systemapi Hide this for inner system use.
|
||||
* @since 12
|
||||
*/
|
||||
toAccountId: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for creating an OS account.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user