diff --git a/zh-cn/application-dev/reference/apis/js-apis-appAccount.md b/zh-cn/application-dev/reference/apis/js-apis-appAccount.md index fe4b165080641d7dd7bb4208864a6846eaa8a247..f7515a6528fb17cf94f2a8c86b339eaac4e1799e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appAccount.md @@ -64,7 +64,6 @@ createAccount(name: string, callback: AsyncCallback<void>): void; **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.createAccount("WangWu", (err) => { console.log("createAccount err: " + JSON.stringify(err)); @@ -102,7 +101,6 @@ createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallba **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); let options = { customData: { "age": "10" @@ -155,7 +153,6 @@ createAccount(name: string, options?: CreateAccountOptions): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); let options = { customData: { "age": "10" @@ -215,7 +212,6 @@ createAccountImplicitly(owner: string, callback: AuthCallback): void }); } - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.createAccountImplicitly("com.example.accountjsdemo", { onResult: onResultCallback, @@ -270,7 +266,6 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions, }); } - let appAccountManager = account_appAccount.createAppAccountManager(); let options = { authType: "getSocialData", requiredLabels: [ "student" ] @@ -311,7 +306,6 @@ removeAccount(name: string, callback: AsyncCallback<void>): void **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.removeAccount("ZhaoLiu", (err) => { if (err) { @@ -356,7 +350,6 @@ removeAccount(name: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.removeAccount("Lisi").then(() => { console.log("removeAccount successfully"); @@ -397,7 +390,6 @@ setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback: **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true, (err) => { if (err) { @@ -445,7 +437,6 @@ setAppAccess(name: string, bundleName: string, isAccessible: boolean): Promise&l **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setAppAccess("ZhangSan", "com.example.accountjsdemo", true).then(() => { console.log("setAppAccess successfully"); @@ -485,7 +476,6 @@ checkAppAccess(name: string, bundleName: string, callback: AsyncCallback<bool **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo", (err, isAccessible) => { if (err) { @@ -532,7 +522,6 @@ checkAppAccess(name: string, bundleName: string): Promise<boolean> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.checkAppAccess("ZhangSan", "com.example.accountjsdemo").then((isAccessible) => { console.log("checkAppAccess successfully, isAccessible: " + isAccessible); @@ -573,7 +562,6 @@ setDataSyncEnabled(name: string, isEnabled: boolean, callback: AsyncCallback< **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setDataSyncEnabled("ZhangSan", true, (err) => { console.log("setDataSyncEnabled err: " + JSON.stringify(err)); @@ -617,7 +605,6 @@ setDataSyncEnabled(name: string, isEnabled: boolean): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager .setDataSyncEnabled("ZhangSan", true).then(() => { console.log('setDataSyncEnabled Success'); @@ -657,7 +644,6 @@ checkDataSyncEnabled(name: string, callback: AsyncCallback<boolean>): void **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.checkDataSyncEnabled("ZhangSan", (err, isEnabled) => { if (err) { @@ -704,7 +690,6 @@ checkDataSyncEnabled(name: string): Promise<boolean> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.checkDataSyncEnabled("ZhangSan").then((isEnabled) => { console.log("checkDataSyncEnabled successfully, isEnabled: " + isEnabled); @@ -744,7 +729,6 @@ setCredential(name: string, credentialType: string, credential: string,callback: **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx", (err) => { if (err) { @@ -791,7 +775,6 @@ setCredential(name: string, credentialType: string, credential: string): Promise **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setCredential("ZhangSan", "PIN_SIX", "xxxxxx").then(() => { console.log("setCredential successfully"); @@ -831,7 +814,6 @@ getCredential(name: string, credentialType: string, callback: AsyncCallback<s **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getCredential("ZhangSan", "PIN_SIX", (err, result) => { if (err) { @@ -878,7 +860,6 @@ getCredential(name: string, credentialType: string): Promise<string> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getCredential("ZhangSan", "PIN_SIX").then((credential) => { console.log("getCredential successfully, credential: " + credential); @@ -919,7 +900,6 @@ setCustomData(name: string, key: string, value: string, callback: AsyncCallback& **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setCustomData("ZhangSan", "age", "12", (err) => { if (err) { @@ -967,7 +947,6 @@ setCustomData(name: string, key: string, value: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setCustomData("ZhangSan", "age", "12").then(() => { console.log("setCustomData successfully"); @@ -1007,7 +986,6 @@ getCustomData(name: string, key: string, callback: AsyncCallback<string>): **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getCustomData("ZhangSan", "age", (err, data) => { if (err) { @@ -1054,7 +1032,6 @@ getCustomData(name: string, key: string): Promise<string> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getCustomData("ZhangSan", "age").then((data) => { console.log("getCustomData successfully, data: " + data); @@ -1099,7 +1076,6 @@ getCustomDataSync(name: string, key: string): string; **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { let value = appAccountManager.getCustomDataSync("ZhangSan", "age"); console.info("getCustomDataSync successfully, vaue:" + value); @@ -1131,7 +1107,6 @@ getAllAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getAllAccounts((err, data) => { if (err) { @@ -1168,7 +1143,6 @@ getAllAccounts(): Promise<Array<AppAccountInfo>> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getAllAccounts().then((data) => { console.debug("getAllAccounts successfully"); @@ -1206,7 +1180,6 @@ getAccountsByOwner(owner: string, callback: AsyncCallback<Array<AppAccount **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getAccountsByOwner("com.example.accountjsdemo2", (err, data) => { if (err) { @@ -1251,7 +1224,6 @@ getAccountsByOwner(owner: string): Promise<Array<AppAccountInfo>> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getAccountsByOwner("com.example.accountjsdemo2").then((data) => { console.debug("getAccountsByOwner successfully, data:" + JSON.stringify(data)); @@ -1291,7 +1263,6 @@ on(type: 'accountChange', owners: Array<string>, callback: Callback<Arr **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); function changeOnCallback(data){ console.log("receive change data:" + JSON.stringify(data)); } @@ -1328,7 +1299,6 @@ off(type: 'accountChange', callback?: Callback<Array<AppAccountInfo>> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); function changeOnCallback(data) { console.log("receive change data:" + JSON.stringify(data)); } @@ -1390,7 +1360,6 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi }); } - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", { onResult: onResultCallback, @@ -1450,7 +1419,6 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj let options = { "password": "xxxx", }; - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.auth("LiSi", "com.example.accountjsdemo", "getSocialData", options, { onResult: onResultCallback, @@ -1490,7 +1458,6 @@ getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallb **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, token) => { if (err) { @@ -1538,7 +1505,6 @@ getAuthToken(name: string, owner: string, authType: string): Promise<string&g **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((token) => { console.log("getAuthToken successfully, token: " + token); @@ -1579,7 +1545,6 @@ setAuthToken(name: string, authType: string, token: string, callback: AsyncCallb **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx", (err) => { if (err) { @@ -1627,7 +1592,6 @@ setAuthToken(name: string, authType: string, token: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setAuthToken("LiSi", "getSocialData", "xxxx").then(() => { console.log("setAuthToken successfully"); @@ -1669,7 +1633,6 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string, ca **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => { if (err) { @@ -1718,7 +1681,6 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string): P **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.deleteAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => { console.log("deleteAuthToken successfully"); @@ -1762,7 +1724,6 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => { if (err) { @@ -1813,7 +1774,6 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => { console.log("setAuthTokenVisibility successfully"); @@ -1855,7 +1815,6 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string, cal **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, isVisible) => { if (err) { @@ -1904,7 +1863,6 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Pr **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.checkAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((isVisible) => { console.log("checkAuthTokenVisibility successfully, isVisible: " + isVisible); @@ -1943,7 +1901,6 @@ getAllAuthTokens(name: string, owner: string, callback: AsyncCallback<Array&l **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo", (err, tokenArr) => { if (err) { @@ -1989,7 +1946,6 @@ getAllAuthTokens(name: string, owner: string): Promise<Array<AuthTokenInfo **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getAllAuthTokens("LiSi", "com.example.accountjsdemo").then((tokenArr) => { console.log('getAllAuthTokens successfully, tokenArr: ' + JSON.stringify(tokenArr)); @@ -2029,7 +1985,6 @@ getAuthList(name: string, authType: string, callback: AsyncCallback<Array< **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData", (err, authList) => { if (err) { @@ -2076,7 +2031,6 @@ getAuthList(name: string, authType: string): Promise<Array<string>> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.getAuthList("com.example.accountjsdemo", "getSocialData").then((authList) => { console.log("getAuthList successfully, authList: " + authList); @@ -2115,7 +2069,6 @@ getAuthCallback(sessionId: string, callback: AsyncCallback<AuthCallback>): ```js import featureAbility from '@ohos.ability.featureAbility'; - let appAccountManager = account_appAccount.createAppAccountManager(); featureAbility.getWant((err, want) => { var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; try { @@ -2175,7 +2128,6 @@ getAuthCallback(sessionId: string): Promise<AuthCallback> ```js import featureAbility from '@ohos.ability.featureAbility'; - let appAccountManager = account_appAccount.createAppAccountManager(); featureAbility.getWant().then((want) => { var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; try { @@ -2228,7 +2180,6 @@ queryAuthenticatorInfo(owner: string, callback: AsyncCallback<AuthenticatorIn **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo", (err, info) => { if (err) { @@ -2273,7 +2224,6 @@ queryAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.queryAuthenticatorInfo("com.example.accountjsdemo").then((info) => { console.log("queryAuthenticatorInfo successfully, info: " + JSON.stringify(info)); @@ -2316,7 +2266,6 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>, cal **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); let labels = ["student"]; try { appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels, (err, hasAllLabels) => { @@ -2367,7 +2316,6 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>): Pr **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); let labels = ["student"]; try { appAccountManager.checkAccountLabels("zhangsan", "com.example.accountjsdemo", labels).then((hasAllLabels) => { @@ -2408,7 +2356,6 @@ deleteCredential(name: string, credentialType: string, callback: AsyncCallback&l **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.deleteCredential("zhangsan", "PIN_SIX", (err) => { if (err) { @@ -2455,7 +2402,6 @@ deleteCredential(name: string, credentialType: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.deleteCredential("zhangsan", "PIN_SIX").then(() => { console.log("deleteCredential successfully"); @@ -2494,7 +2440,6 @@ selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback& **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); let options = { allowedOwners: [ "com.example.accountjsdemo" ], requiredLabels: [ "student" ] @@ -2544,7 +2489,6 @@ selectAccountsByOptions(options: SelectAccountsOptions): Promise<Array<App **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); let options = { allowedOwners: ["com.example.accountjsdemo"] }; @@ -2589,7 +2533,6 @@ verifyCredential(name: string, owner: string, callback: AuthCallback): void; **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.verifyCredential("zhangsan", "com.example.accountjsdemo", { onResult: (resultCode, result) => { @@ -2636,7 +2579,6 @@ verifyCredential(name: string, owner: string, options: VerifyCredentialOptions, **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); let options = { credentialType: "pin", credential: "123456" @@ -2684,7 +2626,6 @@ setAuthenticatorProperties(owner: string, callback: AuthCallback): void; **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); try { appAccountManager.setAuthenticatorProperties("com.example.accountjsdemo", { onResult: (resultCode, result) => { @@ -2729,7 +2670,6 @@ setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callbac **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); let options = { properties: {"prop1": "value1"} }; @@ -2772,7 +2712,6 @@ addAccount(name: string, callback: AsyncCallback<void>): void **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.addAccount("WangWu", (err) => { console.log("addAccount err: " + JSON.stringify(err)); }); @@ -2800,7 +2739,6 @@ addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>) **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.addAccount("LiSi", "token101", (err) => { console.log("addAccount err: " + JSON.stringify(err)); }); @@ -2833,7 +2771,6 @@ addAccount(name: string, extraInfo?: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.addAccount("LiSi", "token101").then(()=> { console.log('addAccount Success'); }).catch((err) => { @@ -2879,7 +2816,6 @@ addAccountImplicitly(owner: string, authType: string, options: {[key: string]: a }); } - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.addAccountImplicitly("com.example.accountjsdemo", "getSocialData", {}, { onResult: onResultCallback, onRequestRedirected: onRequestRedirectedCallback @@ -2908,7 +2844,6 @@ deleteAccount(name: string, callback: AsyncCallback<void>): void **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.deleteAccount("ZhaoLiu", (err) => { console.log("deleteAccount err: " + JSON.stringify(err)); }); @@ -2941,7 +2876,6 @@ deleteAccount(name: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.deleteAccount("ZhaoLiu").then(() => { console.log('deleteAccount Success'); }).catch((err) => { @@ -2971,7 +2905,6 @@ disableAppAccess(name: string, bundleName: string, callback: AsyncCallback<vo **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => { console.log("disableAppAccess err: " + JSON.stringify(err)); }); @@ -3005,7 +2938,6 @@ disableAppAccess(name: string, bundleName: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.disableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => { console.log('disableAppAccess Success'); }).catch((err) => { @@ -3036,7 +2968,6 @@ enableAppAccess(name: string, bundleName: string, callback: AsyncCallback<voi **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo", (err) => { console.log("enableAppAccess: " + JSON.stringify(err)); }); @@ -3070,7 +3001,6 @@ enableAppAccess(name: string, bundleName: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.enableAppAccess("ZhangSan", "com.example.accountjsdemo").then(() => { console.log('enableAppAccess Success'); }).catch((err) => { @@ -3102,7 +3032,6 @@ checkAppAccountSyncEnable(name: string, callback: AsyncCallback<boolean>): **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.checkAppAccountSyncEnable("ZhangSan", (err, result) => { console.log("checkAppAccountSyncEnable err: " + JSON.stringify(err)); console.log('checkAppAccountSyncEnable result: ' + result); @@ -3138,7 +3067,6 @@ checkAppAccountSyncEnable(name: string): Promise<boolean> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.checkAppAccountSyncEnable("ZhangSan").then((data) => { console.log('checkAppAccountSyncEnable, result: ' + data); }).catch((err) => { @@ -3170,7 +3098,6 @@ setAccountCredential(name: string, credentialType: string, credential: string,ca **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001", (err) => { console.log("setAccountCredential err: " + JSON.stringify(err)); }); @@ -3205,7 +3132,6 @@ setAccountCredential(name: string, credentialType: string, credential: string): **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setAccountCredential("ZhangSan", "credentialType001", "credential001").then(() => { console.log('setAccountCredential Success'); }).catch((err) => { @@ -3237,7 +3163,6 @@ setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback< **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002", (err) => { console.log("setAccountExtraInfo err: " + JSON.stringify(err)); }); @@ -3272,7 +3197,6 @@ setAccountExtraInfo(name: string, extraInfo: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setAccountExtraInfo("ZhangSan", "Tk002").then(() => { console.log('setAccountExtraInfo Success'); }).catch((err) => { @@ -3305,7 +3229,6 @@ setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setAppAccountSyncEnable("ZhangSan", true, (err) => { console.log("setAppAccountSyncEnable err: " + JSON.stringify(err)); }); @@ -3341,7 +3264,6 @@ setAppAccountSyncEnable(name: string, isEnable: boolean): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager .setAppAccountSyncEnable("ZhangSan", true).then(() => { console.log('setAppAccountSyncEnable Success'); }).catch((err) => { @@ -3374,7 +3296,6 @@ setAssociatedData(name: string, key: string, value: string, callback: AsyncCallb **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setAssociatedData("ZhangSan", "k001", "v001", (err) => { console.log("setAssociatedData err: " + JSON.stringify(err)); }); @@ -3410,7 +3331,6 @@ setAssociatedData(name: string, key: string, value: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setAssociatedData("ZhangSan", "k001", "v001").then(() => { console.log('setAssociatedData Success'); }).catch((err) => { @@ -3441,7 +3361,6 @@ getAllAccessibleAccounts(callback: AsyncCallback<Array<AppAccountInfo>& **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAllAccessibleAccounts((err, data)=>{ console.debug("getAllAccessibleAccounts err:" + JSON.stringify(err)); console.debug("getAllAccessibleAccounts data:" + JSON.stringify(data)); @@ -3471,7 +3390,6 @@ getAllAccessibleAccounts(): Promise<Array<AppAccountInfo>> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAllAccessibleAccounts().then((data) => { console.log('getAllAccessibleAccounts: ' + data); }).catch((err) => { @@ -3503,7 +3421,6 @@ getAllAccounts(owner: string, callback: AsyncCallback<Array<AppAccountInfo **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); const selfBundle = "com.example.actsgetallaaccounts"; appAccountManager.getAllAccounts(selfBundle, (err, data)=>{ console.debug("getAllAccounts err:" + JSON.stringify(err)); @@ -3540,7 +3457,6 @@ getAllAccounts(owner: string): Promise<Array<AppAccountInfo>> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); const selfBundle = "com.example.actsgetallaaccounts"; appAccountManager.getAllAccounts(selfBundle).then((data) => { console.log('getAllAccounts: ' + data); @@ -3572,7 +3488,6 @@ getAccountCredential(name: string, credentialType: string, callback: AsyncCallba **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAccountCredential("ZhangSan", "credentialType001", (err, result) => { console.log("getAccountCredential err: " + JSON.stringify(err)); console.log('getAccountCredential result: ' + result); @@ -3607,7 +3522,6 @@ getAccountCredential(name: string, credentialType: string): Promise<string> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAccountCredential("ZhangSan", "credentialType001").then((data) => { console.log('getAccountCredential, result: ' + data); }).catch((err) => { @@ -3637,7 +3551,6 @@ getAccountExtraInfo(name: string, callback: AsyncCallback<string>): void **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAccountExtraInfo("ZhangSan", (err, result) => { console.log("getAccountExtraInfo err: " + JSON.stringify(err)); console.log('getAccountExtraInfo result: ' + result); @@ -3671,7 +3584,6 @@ getAccountExtraInfo(name: string): Promise<string> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAccountExtraInfo("ZhangSan").then((data) => { console.log('getAccountExtraInfo, result: ' + data); }).catch((err) => { @@ -3702,7 +3614,6 @@ getAssociatedData(name: string, key: string, callback: AsyncCallback<string&g **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAssociatedData("ZhangSan", "k001", (err, result) => { console.log("getAssociatedData err: " + JSON.stringify(err)); console.log('getAssociatedData result: ' + result); @@ -3737,7 +3648,6 @@ getAssociatedData(name: string, key: string): Promise<string> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAssociatedData("ZhangSan", "k001").then((data) => { console.log('getAssociatedData: ' + data); }).catch((err) => { @@ -3768,7 +3678,6 @@ on(type: 'change', owners: Array<string>, callback: Callback<Array<A **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); function changeOnCallback(data){ console.debug("receive change data:" + JSON.stringify(data)); } @@ -3802,7 +3711,6 @@ off(type: 'change', callback?: Callback<Array<AppAccountInfo>>): voi **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); function changeOnCallback(data){ console.debug("receive change data:" + JSON.stringify(data)); appAccountManager.off('change', function(){ @@ -3856,7 +3764,6 @@ authenticate(name: string, owner: string, authType: string, options: {[key: stri }); } - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.authenticate("LiSi", "com.example.accountjsdemo", "getSocialData", {}, { onResult: onResultCallback, onRequestRedirected: onRequestRedirectedCallback @@ -3887,7 +3794,6 @@ getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCall **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", (err, data) => { console.log('getOAuthToken err: ' + JSON.stringify(err)); console.log('getOAuthToken token: ' + data); @@ -3923,7 +3829,6 @@ getOAuthToken(name: string, owner: string, authType: string): Promise<string& **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData").then((data) => { console.log('getOAuthToken token: ' + data); }).catch((err) => { @@ -3955,7 +3860,6 @@ setOAuthToken(name: string, authType: string, token: string, callback: AsyncCall **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx", (err) => { console.log('setOAuthToken err: ' + JSON.stringify(err)); }); @@ -3990,7 +3894,6 @@ setOAuthToken(name: string, authType: string, token: string): Promise<void> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setOAuthToken("LiSi", "getSocialData", "xxxx").then(() => { console.log('setOAuthToken successfully'); }).catch((err) => { @@ -4023,7 +3926,6 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string, c **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx", (err) => { console.log('deleteOAuthToken err: ' + JSON.stringify(err)); }); @@ -4059,7 +3961,6 @@ deleteOAuthToken(name: string, owner: string, authType: string, token: string): **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.deleteOAuthToken("LiSi", "com.example.accountjsdemo", "getSocialData", "xxxxx").then(() => { console.log('deleteOAuthToken successfully'); }).catch((err) => { @@ -4092,7 +3993,6 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true, (err) => { console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err)); }); @@ -4128,7 +4028,6 @@ setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVi **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.setOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", true).then(() => { console.log('setOAuthTokenVisibility successfully'); }).catch((err) => { @@ -4160,7 +4059,6 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, ca **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo", (err, data) => { console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err)); console.log('checkOAuthTokenVisibility isVisible: ' + data); @@ -4196,7 +4094,6 @@ checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): P **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.checkOAuthTokenVisibility("LiSi", "getSocialData", "com.example.accountjsdemo").then((data) => { console.log('checkOAuthTokenVisibility isVisible: ' + data); }).catch((err) => { @@ -4227,7 +4124,6 @@ getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback<Array& **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo", (err, data) => { console.log("getAllOAuthTokens err: " + JSON.stringify(err)); console.log('getAllOAuthTokens data: ' + JSON.stringify(data)); @@ -4262,7 +4158,6 @@ getAllOAuthTokens(name: string, owner: string): Promise<Array<OAuthTokenIn **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAllOAuthTokens("LiSi", "com.example.accountjsdemo").then((data) => { console.log('getAllOAuthTokens data: ' + JSON.stringify(data)); }).catch((err) => { @@ -4293,7 +4188,6 @@ getOAuthList(name: string, authType: string, callback: AsyncCallback<Array< **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData", (err, data) => { console.log('getOAuthList err: ' + JSON.stringify(err)); console.log('getOAuthList data: ' + JSON.stringify(data)); @@ -4328,7 +4222,6 @@ getOAuthList(name: string, authType: string): Promise<Array<string>> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getOAuthList("com.example.accountjsdemo", "getSocialData").then((data) => { console.log('getOAuthList data: ' + JSON.stringify(data)); }).catch((err) => { @@ -4359,7 +4252,6 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<Authentic ```js import featureAbility from '@ohos.ability.featureAbility'; - let appAccountManager = account_appAccount.createAppAccountManager(); featureAbility.getWant((err, want) => { var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => { @@ -4405,7 +4297,6 @@ getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback> ```js import featureAbility from '@ohos.ability.featureAbility'; - let appAccountManager = account_appAccount.createAppAccountManager(); featureAbility.getWant().then((want) => { var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { @@ -4444,7 +4335,6 @@ getAuthenticatorInfo(owner: string, callback: AsyncCallback<AuthenticatorInfo **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo", (err, data) => { console.log("getAuthenticatorInfo err: " + JSON.stringify(err)); console.log('getAuthenticatorInfo data: ' + JSON.stringify(data)); @@ -4478,7 +4368,6 @@ getAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo> **示例:** ```js - let appAccountManager = account_appAccount.createAppAccountManager(); appAccountManager.getAuthenticatorInfo("com.example.accountjsdemo").then((data) => { console.log('getAuthenticatorInfo: ' + JSON.stringify(data)); }).catch((err) => {