1# JS API Differences 2This document describes the changes of APIs in OpenHarmony 2.2 Beta2 over OpenHarmony 2.0 Canary. 3## Standard System API Changes 4 5| Module | API | Change Type | Change Description | 6| -------- | -------- | -------- | -------- | 7| Time, date, and digit module - Locale | constructor(locale: string, options?:options) | Added | - | 8| Time, date, and digit module - Locale | toString(): string | Added | - | 9| Time, date, and digit module - Locale | maximize(): Locale | Added | - | 10| Time, date, and digit module - Locale | minimize(): Locale | Added | - | 11| Time, date, and digit module - Locale | calendar | Added | - | 12| Time, date, and digit module - Locale | caseFirst | Added | - | 13| Time, date, and digit module - Locale | collation | Added | - | 14| Time, date, and digit module - Locale | hourCycle | Added | - | 15| Time, date, and digit module - Locale | numberingSystem | Added | - | 16| Time, date, and digit module - Locale | numeric | Added | - | 17| Time, date, and digit module - Locale | language | Added | - | 18| Time, date, and digit module - Locale | script | Added | - | 19| Time, date, and digit module - Locale | region | Added | - | 20| Time, date, and digit module - Locale | baseName | Added | - | 21| Time, date, and digit module - DateTimeFormat | constructor(locale: string, options?:options) | Added | - | 22| Time, date, and digit module - DateTimeFormat | constructor(locale: string[], options?:options) | Added | - | 23| Time, date, and digit module - DateTimeFormat | resolvedOptions(): DateTimeOptions | Added | - | 24| Time, date, and digit module - DateTimeFormat | format(date: Date): string; | Added | - | 25| Time, date, and digit module - DateTimeFormat | formatRange(fromDate: Date, toDate: Date): string; | Added | - | 26| Time, date, and digit module - NumberFormat | constructor(locale: string, options?:options) | Added | - | 27| Time, date, and digit module - NumberFormat | constructor(locale: string[], options?:options) | Added | - | 28| Time, date, and digit module - NumberFormat | resolvedOptions(): NumberOptions | Added | - | 29| Time, date, and digit module - NumberFormat | format(number: number): string; | Added | - | 30| Time, date, and digit module - DateTimeOptions | locale | Added | - | 31| Time, date, and digit module - DateTimeOptions | dateStyle | Added | - | 32| Time, date, and digit module - DateTimeOptions | timeStyle | Added | - | 33| Time, date, and digit module - DateTimeOptions | calendar | Added | - | 34| Time, date, and digit module - DateTimeOptions | dayPeriod | Added | - | 35| Time, date, and digit module - DateTimeOptions | numberingSystem | Added | - | 36| Time, date, and digit module - DateTimeOptions | localeMatcher | Added | - | 37| Time, date, and digit module - DateTimeOptions | timeZone | Added | - | 38| Time, date, and digit module - DateTimeOptions | hour12 | Added | - | 39| Time, date, and digit module - DateTimeOptions | hourCycle | Added | - | 40| Time, date, and digit module - DateTimeOptions | formatMatcher | Added | - | 41| Time, date, and digit module - DateTimeOptions | weekday | Added | - | 42| Time, date, and digit module - DateTimeOptions | era | Added | - | 43| Time, date, and digit module - DateTimeOptions | year | Added | - | 44| Time, date, and digit module - DateTimeOptions | month | Added | - | 45| Time, date, and digit module - DateTimeOptions | day | Added | - | 46| Time, date, and digit module - DateTimeOptions | hour | Added | - | 47| Time, date, and digit module - DateTimeOptions | minute | Added | - | 48| Time, date, and digit module - DateTimeOptions | second | Added | - | 49| Time, date, and digit module - DateTimeOptions | timeZoneName | Added | - | 50| Time, date, and digit module - NumberOptions | locale | Added | - | 51| Time, date, and digit module - NumberOptions | compactDisplay | Added | - | 52| Time, date, and digit module - NumberOptions | currency | Added | - | 53| Time, date, and digit module - NumberOptions | currencyDisplay | Added | - | 54| Time, date, and digit module - NumberOptions | currencySign | Added | - | 55| Time, date, and digit module - NumberOptions | localeMatcher | Added | - | 56| Time, date, and digit module - NumberOptions | notation | Added | - | 57| Time, date, and digit module - NumberOptions | numberingSystem | Added | - | 58| Time, date, and digit module - NumberOptions | signDisplay | Added | - | 59| Time, date, and digit module - NumberOptions | style | Added | - | 60| Time, date, and digit module - NumberOptions | unit | Added | - | 61| Time, date, and digit module - NumberOptions | unitDisplay | Added | - | 62| Time, date, and digit module - NumberOptions | useGrouping | Added | - | 63| Time, date, and digit module - NumberOptions | minimumIntegerDigits | Added | - | 64| Time, date, and digit module - NumberOptions | minimumFractionDigits | Added | - | 65| Time, date, and digit module - NumberOptions | maximumFractionDigits | Added | - | 66| Time, date, and digit module - NumberOptions | minimumSignificantDigits | Added | - | 67| Time, date, and digit module - NumberOptions | maximumSignificantDigits | Added | - | 68|File storage - system.file|mkdir|Added|-| 69|File storage - system.file|rmdir|Added|-| 70|File storage - system.file|get|Added|-| 71|File storage - system.file|list|Added|-| 72|File storage - system.file|copy|Added|-| 73|File storage - system.file|move|Added|-| 74|File storage - system.file|delete|Added|-| 75|File storage - system.file|access|Added|-| 76|File storage - system.file|writeText|Added|-| 77|File storage - system.file|writeArrayBuffer|Added|-| 78|File storage - system.file|readText|Added|-| 79|File storage - system.file|readArrayBuffer|Added|-| 80|File storage - fileio|Dir.readSync|Added|-| 81|File storage - fileio|Dir.closeSync|Added|-| 82|File storage - fileio|dirent.name|Added|-| 83|File storage - fileio|dirent.isBlockDevice()|Added|-| 84|File storage - fileio|dirent.isCharacterDevice()|Added|-| 85|File storage - fileio|dirent.isDirectory()|Added|-| 86|File storage - fileio|dirent.isFIFO()|Added|-| 87|File storage - fileio|dirent.isFile()|Added|-| 88|File storage - fileio|dirent.isSocket()|Added|-| 89|File storage - fileio|dirent.isSymbolicLink()|Added|-| 90|File storage - fileio|stat.dev|Added|-| 91|File storage - fileio|stat.ino|Added|-| 92|File storage - fileio|stat.mode|Added|-| 93|File storage - fileio|stat.nlink|Added|-| 94|File storage - fileio|stat.uid|Added|-| 95|File storage - fileio|stat.gid|Added|-| 96|File storage - fileio|stat.rdev|Added|-| 97|File storage - fileio|stat.size|Added|-| 98|File storage - fileio|stat.blocks|Added|-| 99|File storage - fileio|stat.atime|Added|-| 100|File storage - fileio|stat.mtime|Added|-| 101|File storage - fileio|stat.ctime|Added|-| 102|File storage - fileio|stat.isBlockDevice()|Added|-| 103|File storage - fileio|stat.isCharacterDevice()|Added|-| 104|File storage - fileio|stat.isDirectory()|Added|-| 105|File storage - fileio|stat.isFIFO()|Added|-| 106|File storage - fileio|stat.isFile()|Added|-| 107|File storage - fileio|stat.isSocket()|Added|-| 108|File storage - fileio|stat.isSymbolicLink()|Added|-| 109|File storage - fileio|Stream.flushSync()|Added|-| 110|File storage - fileio|Stream.writeSync()|Added|-| 111|File storage - fileio|Stream.readSync()|Added|-| 112|File storage - fileio|Stream.closeSync()|Added|-| 113|File storage - fileio|fileio.accessSync()|Added|-| 114|File storage - fileio|fileio.chmodSync()|Added|-| 115|File storage - fileio|fileio.chownSync()|Added|-| 116|File storage - fileio|fileio.closeSync()|Added|-| 117|File storage - fileio|fileio.copyFileSync()|Added|-| 118|File storage - fileio|fileio.createStreamSync()|Added|-| 119|File storage - fileio|fileio.fchmodSync()|Added|-| 120|File storage - fileio|fileio.fchownSync()|Added|-| 121|File storage - fileio|fileio.fdopenStreamSync()|Added|-| 122|File storage - fileio|fileio.fstatSync()|Added|-| 123|File storage - fileio|fileio.fsyncSync()|Added|-| 124|File storage - fileio|fileio.ftruncateSync()|Added|-| 125|File storage - fileio|fileio.mkdirSync()|Added|-| 126|File storage - fileio|fileio.openSync()|Added|-| 127|File storage - fileio|fileio.opendirSync()|Added|-| 128|File storage - fileio|fileio.readSync()|Added|-| 129|File storage - fileio|fileio.renameSync()|Added|-| 130|File storage - fileio|fileio.rmdirSync()|Added|-| 131|File storage - fileio|fileio.statSync()|Added|-| 132|File storage - fileio|fileio.truncateSync()|Added|-| 133|File storage - fileio|fileio.unlinkSync()|Added|-| 134|File storage - fileio|fileio.writeSync()|Added|-| 135|Device management - DeviceManager|DeviceInfo|Added|-| 136|Device management - DeviceManager|DeviceType|Added|-| 137|Device management - DeviceManager|DeviceStateChangeAction|Added|-| 138|Device management - DeviceManager|SubscribeInfo|Added|-| 139|Device management - DeviceManager|DiscoverMode|Added|-| 140|Device management - DeviceManager|ExchangeMedium|Added|-| 141|Device management - DeviceManager|ExchangeFreq|Added|-| 142|Device management - DeviceManager|SubscribeCap|Added|-| 143|Device management - DeviceManager|createDeviceManager(bundleName: string, callback: AsyncCallback\<DeviceManager>): void|Added|-| 144|Device management - DeviceManager|release(): void|Added|-| 145|Device management - DeviceManager|getTrustedDeviceListSync(): Array\<DeviceInfo>|Added|-| 146|Device management - DeviceManager|startDeviceDiscovery(subscribeInfo: SubscribeInfo): void|Added|-| 147|Device management - DeviceManager|stopDeviceDiscovery(subscribeId: number): void|Added|-| 148|Device management - DeviceManager|authenticateDevice(deviceInfo: DeviceInfo): void|Added|-| 149|Device management - DeviceManager|on(type: 'deviceStateChange', callback: Callback\<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void|Added|-| 150|Device management - DeviceManager|off(type: 'deviceStateChange', callback?: Callback\<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void|Added|-| 151|Device management - DeviceManager|on(type: 'deviceFound', callback: Callback\<{ subscribeId: number, device: DeviceInfo }>): void|Added|-| 152|Device management - DeviceManager|off(type: 'deviceFound', callback?: Callback\<{ subscribeId: number, device: DeviceInfo }>): void|Added|-| 153|Device management - DeviceManager|on(type: 'discoverFail', callback: Callback\<{ subscribeId: number, reason: number }>): void|Added|-| 154|Device management - DeviceManager|off(type: 'discoverFail', callback?: Callback\<{ subscribeId: number, reason: number }>): void|Added|-| 155|Device management - DeviceManager|on(type: 'authResult', callback: Callback\<{ deviceId: string, status: number, reason: number }>): void|Added|-| 156|Device management - DeviceManager|off(type: 'authResult', callback?: Callback\<{ deviceId: string, status: number, reason: number }>): void|Added|-| 157|Device management - DeviceManager|on(type: 'serviceDie', callback: () => void): void|Added|-| 158|Device management - DeviceManager|off(type: 'serviceDie', callback?: () => void): void|Added|-| 159|Playback and recording|createAudioPlayer(): AudioPlayer|Added|-| 160|Playback and recording|AudioState|Added|-| 161|Playback and recording|play(): void|Added|-| 162|Playback and recording|pause(): void|Added|-| 163|Playback and recording|stop(): void|Added|-| 164|Playback and recording|seek(timeMs: number): void|Added|-| 165|Playback and recording|setVolume(vol: number): void|Added|-| 166|Playback and recording|reset(): void|Added|-| 167|Playback and recording|release(): void|Added|-| 168|Playback and recording|src: string|Added|-| 169|Playback and recording|loop: boolean|Added|-| 170|Playback and recording|readonly currentTime: number|Added|-| 171|Playback and recording|readonly duration: number|Added|-| 172|Playback and recording|readonly state: AudioState|Added|-| 173|Playback and recording|on(type: 'play' / 'pause' / 'stop' / 'reset' / 'dataLoad' / 'finish' / 'volumeChange', callback: () => void): void|Added|-| 174|Playback and recording|on(type: 'timeUpdate', callback: Callback\<number>): void|Added|-| 175|Playback and recording|on(type: 'error', callback: ErrorCallback): void|Added|-| 176|Audio management|getAudioManager(): AudioManager|Added|-| 177|Audio management|AudioVolumeType|Added|-| 178|Audio management|MEDIA|Added|-| 179|Audio management|RINGTONE|Added|-| 180|Audio management|DeviceFlag|Added|-| 181|Audio management|OUTPUT_DEVICES_FLAG|Added|-| 182|Audio management|INPUT_DEVICES_FLAG |Added|-| 183|Audio management|ALL_DEVICES_FLAG |Added|-| 184|Audio management|DeviceRole |Added|-| 185|Audio management|INPUT_DEVICE |Added|-| 186|Audio management|OUTPUT_DEVICE |Added|-| 187|Audio management|DeviceType |Added|-| 188|Audio management|INVALID |Added|-| 189|Audio management|SPEAKER |Added|-| 190|Audio management|WIRED_HEADSET |Added|-| 191|Audio management|BLUETOOTH_SCO |Added|-| 192|Audio management|BLUETOOTH_A2DP |Added|-| 193|Audio management|MIC|Added|-| 194|Audio management|AudioRingMode |Added|-| 195|Audio management|RINGER_MODE_NORMAL |Added|-| 196|Audio management|RINGER_MODE_SILENT|Added|-| 197|Audio management|RINGER_MODE_VIBRATE |Added|-| 198|Audio management|setVolume(audioType: AudioVolumeType, volume: number,callback: AsyncCallback\<void>): void|Added|-| 199|Audio management|setVolume(audioType: AudioVolumeType, volume: number): Promise\<void>|Added|-| 200|Audio management|getVolume(audioType: AudioVolumeType, callback: AsyncCallback\<number>): void|Added|-| 201|Audio management|getVolume(audioType: AudioVolumeType): Promise\<number>|Added|-| 202|Audio management|getMinVolume(audioType: AudioVolumeType, callback: AsyncCallback\<number>): void|Added|-| 203|Audio management|getMinVolume(audioType: AudioVolumeType): Promise\<number>|Added|-| 204|Audio management|getMaxVolume(audioType: AudioVolumeType, callback: AsyncCallback\<number>): void|Added|-| 205|Audio management|getMaxVolume(audioType: AudioVolumeType): Promise\<number>|Added|-| 206|Audio management|getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback\<AudioDeviceDescriptors>): void|Added|-| 207|Audio management|getDevices(deviceFlag: DeviceFlag): Promise\<AudioDeviceDescriptors>|Added|-| 208|Audio management|getRingerMode(callback: AsyncCallback\<AudioRingMode>): void|Added|-| 209|Audio management|getRingerMode(): Promise\<AudioRingMode>|Added|-| 210|Audio management|setRingerMode(mode: AudioRingMode, callback: AsyncCallback\<void>): void|Added|-| 211|Audio management|setRingerMode(mode: AudioRingMode): Promise\<void>|Added|-| 212|Audio management|isMute(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void|Added|-| 213|Audio management|isMute(volumeType: AudioVolumeType): Promise\<boolean>|Added|-| 214|Audio management|isActive(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void|Added|-| 215|Audio management|isActive(volumeType: AudioVolumeType): Promise\<boolean>|Added|-| 216|Audio management|isMicrophoneMute(callback: AsyncCallback\<boolean>): void|Added|-| 217|Audio management|isMicrophoneMute(): Promise\<boolean>|Added|-| 218|Audio management|mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\<void>) : void|Added|-| 219|Audio management|mute(volumeType: AudioVolumeType, mute: boolean): Promise\<void>|Added|-| 220|Audio management|setMicrophoneMute(mute: boolean, callback: AsyncCallback\<void>): void|Added|-| 221|Audio management|setMicrophoneMute(mute: boolean): Promise\<void>|Added|-| 222|Audio management|isDeviceActive(deviceType: DeviceType, callback: AsyncCallback\<boolean>): void|Added|-| 223|Audio management|isDeviceActive(deviceType: DeviceType): Promise\<boolean>|Added|-| 224|Audio management|setDeviceActive(deviceType: DeviceType, active: boolean, callback: AsyncCallback\<boolean>): void|Added|-| 225|Audio management|setDeviceActive(deviceType: DeviceType, active: boolean): Promise\<boolean>|Added|-| 226|Audio management|getAudioParameter(key: string, callback: AsyncCallback\<string>): void|Added|-| 227|Audio management|getAudioParameter(key: string): Promise\<string>|Added|-| 228|Audio management|setAudioParameter(key: string, value: string, callback: AsyncCallback\<void>): void|Added|-| 229|Audio management|setAudioParameter(key: string, value: string): Promise\<void>|Added|-| 230|Audio management|AudioDeviceDescriptor|Added|-| 231|Audio management|readonly deviceRole: DeviceRole|Added|-| 232|Audio management|readonly deviceType: DeviceType|Added|-| 233|Audio management|AudioDeviceDescriptors |Added|-| 234