source stringlengths 14 113 | code stringlengths 10 21.3k |
|---|---|
release-notes\changelogs\OpenHarmony_5.0.0.12\changelogs-arkui.md | @Entry
@Component
struct AccessRestrictions {
build() {
Column() {
ComponentChild({link_value: "Hello", objectLink_value: new ComponentObj()})
}
.width('100%')
}
}
@Observed
class ComponentObj {
count: number = 0;
}
@Component
struct ComponentChild {
@Link private link_value: string;
@Objec... |
release-notes\changelogs\OpenHarmony_5.0.0.12\changelogs-arkui.md | @Entry
@Component
struct AccessRestrictions {
build() {
Column() {
ComponentChild({regular_value: "Hello"})
}
.width('100%')
}
}
@Component
struct ComponentChild {
protected regular_value: string = "Hello";
build() {
Column() {
Text("Hello")
.fontSize(50)
.fontWeight... |
release-notes\changelogs\OpenHarmony_5.0.0.12\changelogs-arkui.md | @Entry
@Component
struct AccessRestrictions {
build() {
Column() {
ComponentChild({prop_value: "Hello"})
}
.width('100%')
}
}
@Component
struct ComponentChild {
@Require @Prop private prop_value: string = "Hello";
build() {
Column() {
Text("Hello")
.fontSize(50)
.font... |
release-notes\changelogs\OpenHarmony_5.0.0.13\changelogs-arkui.md | class PropA {
num: number = 100;
}
AppStorage.setOrCreate("PropA", null);
AppStorage.has("PropA");// Because null and undefined are not supported, false is returned.
@Entry
@Component
struct TestPage {
@StorageLink('PropA') propA: PropA = new PropA();
build() {
Column() {
Text(this.propA.num.toString... |
release-notes\changelogs\OpenHarmony_5.0.0.13\changelogs-arkui.md | class PropA {
num: number = 100;
}
AppStorage.setOrCreate("PropA", null);
AppStorage.has("PropA");// Because null and undefined are supported, true is returned.
@Entry
@Component
struct TestPage {
@StorageLink('PropA') propA: PropA = new PropA();
build() {
Column() {
Text(this.propA.num.toString()) /... |
release-notes\changelogs\OpenHarmony_5.0.0.13\changelogs-arkui.md | class PropA {
num: number = 100;
}
AppStorage.setOrCreate("PropA", null);
AppStorage.has("PropA"); // Because null and undefined are supported, true is returned.
@Entry
@Component
struct TestPage {
@StorageLink('PropA') propA: PropA | null | undefined = new PropA();
build() {
Column() {
Text(this.pro... |
release-notes\changelogs\OpenHarmony_5.0.0.17\changelogs-arkui.md | import router from '@ohos.router';
// Record all dialog boxes on the current page.
const dialogs: Map<string, CustomDialogController> = new Map();
@CustomDialog
struct CustomDialogExample {
controllerTwo?: CustomDialogController
build() {
Column() {
Button('Redirect')
.onClick(() => {
/... |
release-notes\changelogs\OpenHarmony_5.0.0.18\changelogs-arkcompiler.md | @Sendable
class A {} // Sendable class
let a = A
@Sendable
class B extends A {}
@Sendable
class C extends a {} // Compilation error: The Sendable class cannot inherit from a variable. |
release-notes\changelogs\OpenHarmony_5.0.0.18\changelogs-arkcompiler.md | @Sendable
class A {}
class B extends A {} // Compilation error: A non-Sendable class cannot inherit from a Sendable class. |
release-notes\changelogs\OpenHarmony_5.0.0.18\changelogs-arkcompiler.md | @Sendable
class B {} // Sendable class
@Sendable
class C<T> {
v: T; // Allow the Sendable class property to use the template type. No compilation error is reported.
constructor(v: T) {
this.v = v;
}
}
let c = new C<B>();
function foo(a: C<B>) {} |
release-notes\changelogs\OpenHarmony_5.0.0.18\changelogs-arkcompiler.md | class B {} // Non-sendable class
@Sendable
class C<T> {}
let c = new C<B>(); // Compilation error: The template type of the Sendable class in the generic class cannot be non-Sendable. |
release-notes\changelogs\OpenHarmony_5.0.0.18\changelogs-arkcompiler.md | // a.ts
export function foo(a: Function) {
a.prototype = String
}
// b.ets
import { foo } from 'a'
@foo
@Sendable
class A {} // Compilation error: A Sendable class cannot use other decorators. |
release-notes\changelogs\OpenHarmony_5.0.0.18\changelogs-arkcompiler.md | @Sendable
class C {}
let c: C = {}; // Compilation error: Do not use object literals or array literals to initialize the Sendable type. |
release-notes\changelogs\OpenHarmony_5.0.0.18\changelogs-arkcompiler.md | class A {}
@Sendable
class B {}
function foo(a: A) {
a as B; // Compilation error: Do not use as to forcibly convert the non-Sendable type to the Sendable type.
} |
release-notes\changelogs\OpenHarmony_5.0.0.18\changelogs-commonlibrary.md | import { taskpool } from '@kit.ArkTS'
@Concurrent
function delay(): void {
let start: number = new Date().getTime();
while (new Date().getTime() - start < 500) {
continue;
}
}
let task1: taskpool.Task = new taskpool.Task(delay);
let task2: taskpool.Task = new taskpool.Task(delay);
let task3: taskpool.Task =... |
release-notes\changelogs\OpenHarmony_5.0.0.19\changelogs-arkts.md | let xml = '<?xml version="1.0" encoding="utf-8"?><![CDATA[ \t data\n]]><![CDATA[< > " and & \t ]]>';
let conv = new convertxml.ConvertXML();
let options = {trim : false, declarationKey:"_declaration",
instructionKey : "_instruction", attributesKey : "_attributes",
textKey : "_text", cdataK... |
release-notes\changelogs\OpenHarmony_5.0.0.19\changelogs-arkui.md | // src/main/ets/entryability/EntryAbility.ets
import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage: window.WindowStage): void {
windowStage.loadContent('pages/Index', (err, da... |
release-notes\changelogs\OpenHarmony_5.0.0.19\changelogs-arkui.md | // src/main/ets/pages/Index.ets
let storage = LocalStorage.getShared();
@CustomDialog
struct CustomDialogExample {
controller?: CustomDialogController
build() {
Column() {
Text('This is a dialog box')
.fontSize(30)
.height(100)
Button('Close Dialog Box')
.onClick(() => {
... |
release-notes\changelogs\OpenHarmony_5.0.0.19\changelogs-arkui.md | @Entry
@Component
struct Test {
colors: Array<any> = [[0xff0000, 0.0], [0x0000ff, 0.3], [0xffff00, 1.0]];
build() {
Row()
.width('90%')
.height(50)
.linearGradient({
angle: 90,
// colors is defined as the Array<any> type. This will result in a compilation error.
colors:... |
release-notes\changelogs\OpenHarmony_5.0.0.21\changelogs-data_object.md | let dataObject = distributedDataObject.create(context, source);
dataObject.setSessionId(sessionId);
dataObject.save (wantParam.targetDevice as string); // Call save() to save data to the target device. |
release-notes\changelogs\OpenHarmony_5.0.0.22\changelogs-arkui.md | @Entry
@Component
struct TextInputExample {
@State Text: string = ''
build() {
Column({ space: 20 }) {
Text('Underline mode')
.width('95%')
// Show an underline.
TextInput({ placeholder: 'underline style' })
.showUnderline(true)
.backgroundColor(Color.Pink)
.wid... |
release-notes\changelogs\OpenHarmony_5.0.0.22\changelogs-arkui.md | @Entry
@Component
struct TextClipExample {
build() {
Column({ space: 20 }) {
Text('This is set wordBreak to WordBreak text Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiwhenuakitanatahu.')
.fontSize(12)
.border({ width: 1 })
.wordBreak(WordBreak.NORMAL)
... |
release-notes\changelogs\OpenHarmony_5.0.0.23\changelogs-arkui.md | // @Track cannot be used within a class decorated by @ObservedV2.
@ObservedV2
class TestObserved {
@Track value: string = "hello"
}
// A class cannot be decorated by both @Observed and @ObservedV2.
@Observed
@ObservedV2
class TestObserved1 {
value: string = "hello"
}
// The use of @Observed and @ObservedV2 must be ... |
release-notes\changelogs\OpenHarmony_5.0.0.23\changelogs-arkui.md | const item: BorderOptions = { width: "10px",color: 0x000000,radius: 10 }
const value1 : Length | EdgeWidths = item.width
const value2 : ResourceColor | EdgeColors = item.color
const value3 : Length | BorderRadiuses = item.radius |
release-notes\changelogs\OpenHarmony_5.0.0.23\changelogs-arkui.md | const item: BorderOptions = { width: "10px",color: 0x000000,radius: 10 }
const value1 : Length | EdgeWidths | LocalizedEdgeWidths | undefined = item.width
const value2 : ResourceColor | EdgeColors | LocalizedEdgeColors | undefined = item.color
const value3 : Length | BorderRadiuses | LocalizedBorderRadiuses | undefi... |
release-notes\changelogs\OpenHarmony_5.0.0.24\changelogs-arkui.md | import promptAction from '@ohos.promptAction';
import http from '@ohos.net.http';
@Entry
@Component
struct Index {
@State message: string = 'Show toast';
build() {
Row() {
Button() {
Text(this.message)
.fontSize(20)
.fontWeight(FontWeight.Bold)
}
.width('100%')
... |
release-notes\changelogs\OpenHarmony_5.0.0.24\changelogs-arkui.md | @Entry
@Component
struct Index {
@Builder thirdBuilder() {
Third()
}
build() {
Column() {
Second({secondBuilder: this.thirdBuilder.bind(this)})
}
}
}
@Component
struct Second {
@Provide message: string = 'Hello';
@BuilderParam secondBuilder: ()=>void;
build() {
Column() {
this... |
release-notes\changelogs\OpenHarmony_5.0.0.24\changelogs-arkui.md | @Builder
function customDialogBuilderFunc(){}
@CustomDialog
struct CustomDialogExampleTwo {
@BuilderParam grandsonBuilderFunc: ()=>void;
grandsonFunc: ()=>void = ()=>{};
controllerTwo?: CustomDialogController;
@State message: string = "I'm the second dialog box.";
@State showIf: boolean = false;
build() {
... |
release-notes\changelogs\OpenHarmony_5.0.0.24\changelogs-arkui.md | @Entry
@Component
struct Index {
@Builder
parentComponent() {
Third()
}
build() {
Column() {
Second({childBuilderParam: this.parentComponent.bind(this)})
}.width('100%').margin({ top: 5 })
}
}
@Component({freezeWhenInactive: true})
struct Second {
@BuilderParam childBuilderParam: ()=>void... |
release-notes\changelogs\OpenHarmony_5.0.0.24\changelogs-sdk.md | // The current project is in the stage model.
import featureAbility from '@ohos.ability.featureAbility';
let context: featureAbility.Context = featureAbility.getContext().getApplicationContext(); |
release-notes\changelogs\OpenHarmony_5.0.0.24\changelogs-sdk.md | // The current project is in the stage model.
import UIAbility from '@ohos.app.ability.UIAbility';
import common from '@ohos.app.ability.common';
export default class EntryAbility extends UIAbility {
onCreate() {
console.log('MyAbility onCreate');
let applicationContext: common.Context;
try {
appli... |
release-notes\changelogs\OpenHarmony_5.0.0.27\changelogs-sensors.md | interface VibratePreset {
type: 'preset';
effectId: string;
count: number;
} |
release-notes\changelogs\OpenHarmony_5.0.0.27\changelogs-sensors.md | interface VibratePreset {
type: 'preset';
effectId: string;
count?: number;
} |
release-notes\changelogs\OpenHarmony_5.0.0.27\changelogs-sensors.md | let effect: VibratePreset = {
type: 'preset',
effectId: 'xxx',
count: 2
};
let count: number | undefined = effect.count; |
release-notes\changelogs\OpenHarmony_5.0.0.29\changelogs-arkcompiler.md | interface I {
one: string,
2: string // no compile-time error
} |
release-notes\changelogs\OpenHarmony_5.0.0.29\changelogs-arkcompiler.md | interface I {
one: string,
2: string // compile-time error
} |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-ability.md | import { UIAbility, Want } from '@kit.AbilityKit';
export default class MyAbility extends UIAbility {
onForeground() {
let applicationContext = this.context.getApplicationContext();
let want: Want = {
bundleName: 'com.example.myapp',
abilityName: 'EntryAbility'
};
try {
applicationC... |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-arkcompiler.md | // declaration.ets
export class NonSendableClass {};
// main.ets
import { NonSendableClass } from './declaration';
import collections from '@arkts.collections';
@Sendable
class SendableClass {
private arr: collections.Array<NonSendableClass> = new collections.Array();
constructor() {
this.arr.push(new... |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-arkcompiler.md | // declaration.ets
export class NonSendableClass {};
// main.ets
import { NonSendableClass } from './declaration';
import collections from '@arkts.collections';
@Sendable
class SendableClass {
private arr: collections.Array<NonSendableClass> = new collections.Array(); // ArkTS compile-time error
constructor()... |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-arkcompiler.md | @Sendable
class SendableClassA<T> {
one: string = '1';
}
class NoneSendableClassA<T> {
one: string = '1';
}
let sendableObjectA: SendableClassA<NoneSendableClassA<number>> = new SendableClassA(); |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-arkcompiler.md | @Sendable
class SendableClassA<T> {
one: string = '1';
}
class NoneSendableClassA<T> {
one: string = '1';
}
let sendableObjectA: SendableClassA<NoneSendableClassA<number>> = new SendableClassA(); // ArkTS compile-time error |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-arkcompiler.md | // declaration.ets
export class NonSendableClass {};
@Sendable
export class SendableClass {};
export class NonSendableClassT<T> {};
@Sendable
export class SendableClassT<T> {};
// main.ets
import { NonSendableClass, SendableClass, NonSendableClassT, SendableClassT } from './declaration';
import collections from '@ark... |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-arkcompiler.md | // declaration.ets
export class NonSendableClass {};
@Sendable
export class SendableClass {};
export class NonSendableClassT<T> {};
@Sendable
export class SendableClassT<T> {};
// main.ets
import { NonSendableClass, SendableClass, NonSendableClassT, SendableClassT } from './declaration';
import collections from '@ark... |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-arkcompiler.md | class NonSendableClass {};
@Sendable
class SendableClass {};
class NonSendableClassT<T> {};
@Sendable
class SendableClassT<T> {};
function getSendable(): SendableClass {
return new NonSendableClass();
}
const objectA: SendableClass = getSendable();
const objectB: SendableClassT<number> = new NonSendableClassT<nu... |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-arkcompiler.md | class NonSendableClass {};
@Sendable
class SendableClass {};
class NonSendableClassT<T> {};
@Sendable
class SendableClassT<T> {};
function getSendable(): SendableClass {
return new NonSendableClass(); // ArkTS compile-time error
}
const objectA: SendableClass = getSendable();
const objectB: SendableClassT<number... |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-notification.md | import { notificationManager } from '@kit.NotificationKit';
import { BusinessError } from '@kit.BasicServicesKit';
// Request notification pop-up window is unable to follow the application window.
notificationManager.requestEnableNotification().then(() => {
console.info("requestEnableNotification success");
}).cat... |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-notification.md | import { notificationManager } from '@kit.NotificationKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { common } from '@kit.AbilityKit';
let context = getContext(this) as common.UIAbilityContext;
// Request notification pop-up window passes in the UIAbilityContext parameter, enabling the pop-up windo... |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-useriam.md | import { userAuth, userAuthIcon } from '@kit.UserAuthenticationKit'; |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-useriam.md | import { userAuth, UserAuthIcon } from '@kit.UserAuthenticationKit'; |
release-notes\changelogs\OpenHarmony_5.0.0.31\changelogs-useriam.md | import { userAuth, UserAuthIcon } from '@kit.UserAuthenticationKit';
@Entry
@Component
struct Index {
authParam: userAuth.AuthParam = {
challenge: new Uint8Array([49, 49, 49, 49, 49, 49]),
authType: [userAuth.UserAuthType.FACE, userAuth.UserAuthType.PIN],
authTrustLevel: userAuth.AuthTrustLevel.ATL3
};... |
release-notes\changelogs\OpenHarmony_5.0.0.32\changelogs-arkts.md | {
const objectParams = new url.URLParams("key=abc")
console.log(objectParams.toString()) // "key=abc"
objectParams.append('key1', 'd e f');
console.log(objectParams.toString()) // "key=abc&key1=d+e+f"
} |
release-notes\changelogs\OpenHarmony_5.0.0.32\changelogs-arkts.md | {
const objectParams = new url.URLParams("key=abc")
console.log(objectParams.toString()) // "key=abc"
objectParams.append('key1', 'd e f');
console.log(objectParams.toString()) // "key=abc&key1=d+++e+++f"
} |
release-notes\changelogs\OpenHarmony_5.0.0.32\changelogs-arkts.md | {
const objectParams = new url.URLParams("key%2b=abc%2B")
console.log(objectParams.toString()) // "key+=abc%2B"
} |
release-notes\changelogs\OpenHarmony_5.0.0.32\changelogs-arkts.md | {
const objectParams = new url.URLParams("key%2b=abc%2B")
console.log(objectParams.toString()) // "key%2B=abc%2B"
} |
release-notes\changelogs\OpenHarmony_5.0.0.32\changelogs-arkts.md | {
const objectParams = new url.URLParams('?fod=1&bard=2')
objectParams.append("key&大", "abc");
objectParams.has('key&大'); // false
objectParams.has('%E5%A4%A7'); // true
objectParams.get('key&大'); // undefined
objectParams.get('%E5%A4%A7'); // abc
} |
release-notes\changelogs\OpenHarmony_5.0.0.32\changelogs-arkts.md | {
const objectParams = new url.URLParams('?fod=1&bard=2')
objectParams.append("key&大", "abc");
objectParams.has('key&大'); // true
objectParams.has('%E5%A4%A7'); // false
objectParams.get('key&大'); // abc
objectParams.get('%E5%A4%A7'); // undefined
} |
release-notes\changelogs\OpenHarmony_5.0.0.36\changelogs-arkcompiler.md | 'use shared';
class NonSendableClass {};
export default NonSendableClass; // The program crashes during GC. |
release-notes\changelogs\OpenHarmony_5.0.0.36\changelogs-arkcompiler.md | 'use shared';
class NonSendableClass {};
export default NonSendableClass; // Compilation error. |
release-notes\changelogs\OpenHarmony_5.0.0.36\changelogs-arkcompiler.md | 'use shared';
class NonSendableClass {};
export type NonSendableAlias = NonSendableClass; |
release-notes\changelogs\OpenHarmony_5.0.0.36\changelogs-arkcompiler.md | 'use shared';
class NonSendableClass {};
export type NonSendableAlias = NonSendableClass; // Warning on the DevEco Studio editing page and compilation warning |
release-notes\changelogs\OpenHarmony_5.0.0.36\changelogs-arkcompiler.md | import { taskpool } from '@kit.ArkTS';
@Sendable
export class SendableData {};
@Sendable
class SendableClass {
handle():void {
new SendableData(); // Runtime exception.
}
}
@Concurrent
async function taskHandle(sendable: SendableClass) {
sendable.handle();
}
taskpool.execute(new taskpool.Task(taskHa... |
release-notes\changelogs\OpenHarmony_5.0.0.36\changelogs-arkcompiler.md | import { taskpool } from '@kit.ArkTS';
@Sendable
export class SendableData {};
@Sendable
class SendableClass {
handle():void {
new SendableData(); // Warning on the DevEco Studio editing page and compilation warning
}
}
@Concurrent
async function taskHandle(sendable: SendableClass) {
sendable.handle(... |
release-notes\changelogs\OpenHarmony_5.0.0.37\changelogs-ability.md | import { common, UIAbility } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
onCreate() {
console.log('MyAbility onCreate');
let moduleContext: common.Context;
try {
moduleContext = this.context.createModuleContext... |
release-notes\changelogs\OpenHarmony_5.0.0.37\changelogs-ability.md | import { common, UIAbility } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
onCreate() {
console.log('MyAbility onCreate');
let moduleContext: common.Context;
try {
common.createModuleContext(this.context,'entry')... |
release-notes\changelogs\OpenHarmony_5.0.0.37\changelogs-ability.md | import { common, UIAbility } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
onCreate() {
console.log('MyAbility onCreate');
let moduleContext: common.Context;
try {
moduleContext = this.context.createModuleContext... |
release-notes\changelogs\OpenHarmony_5.0.0.37\changelogs-ability.md | import { common, UIAbility } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
onCreate() {
console.log('MyAbility onCreate');
let moduleContext: common.Context;
try {
common.createModuleContext(this.context, 'bunlen... |
release-notes\changelogs\OpenHarmony_5.0.0.37\changelogs-ability.md | import { common, UIAbility } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
onCreate() {
console.log('MyAbility onCreate');
let bundleContext: common.Context;
try {
bundleContext = this.context.createBundleContext... |
release-notes\changelogs\OpenHarmony_5.0.0.37\changelogs-ability.md | import { common, UIAbility } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
onCreate() {
console.log('MyAbility onCreate');
let bundleContext: common.Context;
try {
common.createBundleContext(this.context,'bundlen... |
release-notes\changelogs\OpenHarmony_5.0.0.38\changelogs-backgroundtasks.md | import { BusinessError } from '@kit.BasicServicesKit';
let timer: reminderAgentManager.ReminderRequestTimer = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 10
}
reminderAgentManager.publishReminder(timer, (err: BusinessError, reminderId: number) => {
// Before the ... |
release-notes\changelogs\OpenHarmony_5.0.0.38\changelogs-backgroundtasks.md | import { BusinessError } from '@kit.BasicServicesKit';
let timer: reminderAgentManager.ReminderRequestTimer = {
reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER,
triggerTimeInSeconds: 10
}
reminderAgentManager.publishReminder(timer, (err: BusinessError, reminderId: number) => {
// After the c... |
release-notes\changelogs\OpenHarmony_5.0.0.38\changelogs-distributeddatamgr.md | try {
await rdbStore.execute("COMMIT");
} catch (err) {
if (err.code === 14800000) {
console.log(`execute failed, code: ${err.code}`);
}
} |
release-notes\changelogs\OpenHarmony_5.0.0.38\changelogs-distributeddatamgr.md | try {
await rdbStore.execute("COMMIT");
} catch (err) {
if (err.code === 14800021) {
console.log(`execute failed, code: ${err.code}`);
}
} |
release-notes\changelogs\OpenHarmony_5.0.0.38\changelogs-distributeddatamgr.md | try {
await rdbStore.executeSync("COMMIT");
} catch (err) {
if (err.code === 14800000) {
console.log(`execute failed, code: ${err.code}`);
}
} |
release-notes\changelogs\OpenHarmony_5.0.0.38\changelogs-distributeddatamgr.md | try {
await rdbStore.executeSync("COMMIT");
} catch (err) {
if (err.code === 14800021) {
console.log(`execute failed, code: ${err.code}`);
}
} |
release-notes\changelogs\OpenHarmony_5.0.0.38\changelogs-securityLable.md | import {fileIo,securityLabel} from '@kit.CoreFileKit';
try {
let path = getContext().filesDir + '/text.txt';
let file = fileIo.openSync(path,fileIo.OpenMode.CREATE);
securityLabel.setSecurityLabelSync(file.path, "s4");
securityLabel.setSecurityLabelSync(file.path, "s3");
console.log( "set secur... |
release-notes\changelogs\OpenHarmony_5.0.0.38\changelogs-securityLable.md | import {fileIo,securityLabel} from '@kit.CoreFileKit';
try {
let path = getContext().filesDir + '/text.txt';
let file = fileIo.openSync(path,fileIo.OpenMode.CREATE);
let label = securityLabel.getSecurityLabelSync(file.path);
console.log( "get security label success, label is" + label);
} catch (err)... |
release-notes\changelogs\OpenHarmony_5.0.0.42\changelogs-arkts.md | import { util } from '@kit.ArkTS';
let encoderUtf16Le = new util.TextEncoder("utf-16le");
let encoderUtf16Be = new util.TextEncoder("utf-16be");
// Before change:
// let u16_le = encoderUtf16Le.encodeInto('abcdefg'); // u16_le: 0,97,0,98,0,99,0,100,0,101,0,102,0,103
// let u16_be = encoderUtf16Be.encodeInto('abcdefg'... |
release-notes\changelogs\OpenHarmony_5.0.0.42\changelogs-arkts.md | import { util } from '@kit.ArkTS';
let encoderUtf16Le = new util.TextEncoder("utf-16le");
let encoderUtf16Be = new util.TextEncoder("utf-16be");
// Before change:
// let dest_le = new Uint8Array(14);
// let dest_be = new Uint8Array(14);
// let res_le = encoderUtf16Le.encodeIntoUint8Array('abcdefg', dest_le); // dest_... |
release-notes\changelogs\OpenHarmony_5.0.0.42\changelogs-window.md | @Builder
function buildText(params: Params) {
Column() {
// Before the change, the font size is 20 if the application uses the small window as the baseline.
// Text(params.text)
// .fontSize(20)
// .fontColor(Color.Red)
// After the change, the font size is adapted based on the actual size of t... |
release-notes\changelogs\OpenHarmony_5.0.0.43\changelogs-arkts.md | import { util } from '@kit.ArkTS';
let decoder = new util.StringDecoder('utf-8');
// 0xE4, 0xBD, 0xA0 Decoding result: Hello
// 0 Decoding result: \u0000 (invisible character, occupying one byte)
// 0xE5, 0xA5, 0xBD decoding result: World
let input = new Uint8Array([0xE4, 0xBD, 0xA0, 0, 0xE5, 0xA5, 0xBD... |
release-notes\changelogs\OpenHarmony_5.0.0.43\changelogs-netmanager.md | int main() {
OH_NetConn_CustomDnsResolver resolver;
// Register a custom DNS resolver.
int result = OH_NetConn_RegisterDnsResolver(resolver);
if (result == 0) {
printf("Custom DNS resolver registered successfully\n");
} else {
printf("Failed to register custom DNS resolver, error cod... |
release-notes\changelogs\OpenHarmony_5.0.0.43\changelogs-netmanager.md | int main() {
OH_NetConn_CustomDnsResolver resolver;
// Register a custom DNS resolver.
int result = OH_NetConn_RegisterDnsResolver(resolver);
if (result == 0) {
printf("Custom DNS resolver registered successfully\n");
} else {
printf("Failed to register custom DNS resolver, error cod... |
release-notes\changelogs\OpenHarmony_5.0.0.46\changelogs-distributeddatamgr.md | import { relationalStore } from '@kit.ArkData';
import { BusinessError } from '@kit.BasicServicesKit';
import { UIAbility } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
const STORE_CONFIG: relationalStore.StoreConfig = {
name: "RdbTest.db",
securityLevel: relationalStore.SecurityLevel.S3
};
const C... |
release-notes\changelogs\OpenHarmony_5.0.0.50\changelogs-multimedia.md | // previewProfile indicates the width and height of the camera resolution chosen by the application, for example, 1080 x 1080.
// component.byteBuffer is the buffer for storing the preview stream data returned by the camera.
receiver.readNextImage((err, nextImage: image.Image)=>{
nextImage.getComponent(image.Compo... |
release-notes\changelogs\OpenHarmony_5.0.0.50\changelogs-multimedia.md | // previewProfile indicates the width and height of the camera resolution chosen by the application, for example, 1080 x 1080.
// component.byteBuffer is the buffer for storing the preview stream data returned by the camera.
receiver.readNextImage((err, nextImage: image.Image)=>{
nextImage.getComponent(image.Compon... |
release-notes\changelogs\OpenHarmony_5.0.0.50\changelogs-multimedia.md | // previewProfile indicates the width and height of the camera resolution chosen by the application, for example, 1080 x 1080.
// component.byteBuffer is the buffer for storing the preview stream data returned by the camera.
receiver.readNextImage((err, nextImage: image.Image)=>{
nextImage.getComponent(image.Compon... |
release-notes\changelogs\OpenHarmony_5.0.0.56\changelogs-window.md | // EntryAbility.ets
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
// ...
onWindowStageCreate(windowStage: window.WindowStage): void {
console.info('onWindowStageCreate');
let windowClass: window.Window | undefined = undefined;
windowStage.g... |
release-notes\changelogs\OpenHarmony_5.0.0.56\changelogs-window.md | // EntryAbility.ets
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
// ...
onWindowStageCreate(windowStage: window.WindowStage): void {
console.info('onWindowStageCreate');
let windowClass: window.Window | undefined = undefined;
windowStage.g... |
release-notes\changelogs\OpenHarmony_5.0.0.57\changelogs-multimedia.md | const context = getContext(this);
const resourceMgr = context.resourceManager;
const rawFile = await resourceMgr.getRawFileContent('test.jpg');
let imageSource: image.ImageSource = image.createImageSource(rawFile.buffer as ArrayBuffer);
let options: image.DecodingOptionsForPicture = {
desiredAuxiliaryPictures: [image... |
release-notes\changelogs\OpenHarmony_5.0.1.1\changelogs-arkdata-rdb.md | import { relationalStore } from '@kit.ArkData';
import { BusinessError } from '@kit.BasicServicesKit';
import { UIAbility } from '@kit.AbilityKit';
import { window } from '@kit.ArkUI';
const STORE_CONFIG: relationalStore.StoreConfig = {
name: "RdbTest.db",
securityLevel: relationalStore.SecurityLevel.S3,
encrypt... |
release-notes\changelogs\OpenHarmony_5.0.1.1\changelogs-arkts.md | import { convertxml } from '@kit.ArkTS';
let xml =
'<?xml version="1.0" encoding="utf-8"?>' +
'<note importance="high" logged="true">' +
' <title>Happy</title>' +
' <todo>Work</todo>' +
' <todo>Play</todo>' +
'</note>';
let conv = new convertxml.ConvertXML()
let options: convertxml.Conve... |
release-notes\changelogs\OpenHarmony_5.0.1.1\changelogs-arkts.md | import { util } from '@kit.ArkTS';
let encoderUtf16Le = new util.TextEncoder("utf-16le");
let encoderUtf16Be = new util.TextEncoder("utf-16be");
// Before change:
// let u8_le = encoderUtf16Le.encodeInto('abcdefg'); // u8_le: 0,97,0,98,0,99,0,100,0,101,0,102,0,103
// let u8_be = encoderUtf16Be.encodeInto('abcdefg'); ... |
release-notes\changelogs\OpenHarmony_5.0.1.1\changelogs-arkts.md | import { util } from '@kit.ArkTS';
let encoderUtf16Le = new util.TextEncoder("utf-16le");
let encoderUtf16Be = new util.TextEncoder("utf-16be");
// Before change:
// let dest_le = new Uint8Array(14);
// let dest_be = new Uint8Array(14);
// let res_le = encoderUtf16Le.encodeIntoUint8Array('abcdefg', dest_le); // dest_... |
release-notes\changelogs\OpenHarmony_5.0.1.1\changelogs-arkts.md | import { CommonModifier } from '@kit.ArkUI';
class ColumnModifier extends CommonModifier {
public radius: number = 0;
applyNormalAttribute(instance: CommonAttribute): void {
instance.backgroundEffect({ radius: this.radius })
}
}
@Entry
@Component
struct Index {
@State testSize: number = 200;
@State modi... |
release-notes\changelogs\OpenHarmony_5.0.1.45\changelogs-window.md | // API version 13 and earlier versions
// EntryAbility.ets
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
// ...
onWindowStageCreate(windowStage: window.WindowStage) {
console.info('onWindowStageCreate');
try {
let windowClass = windowStag... |
release-notes\changelogs\OpenHarmony_5.0.1.45\changelogs-window.md | // API version 14 or later
// EntryAbility.ets
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
// ...
onWindowStageCreate(windowStage: window.WindowStage) {
console.info('onWindowStageCreate');
try {
let windowClass = windowStage.getMainWin... |
release-notes\changelogs\OpenHarmony_5.0.1.45\changelogs-window.md | // API version 14 or later
// EntryAbility.ets
import { BusinessError } from '@kit.BasicServicesKit';
export default class EntryAbility extends UIAbility {
// ...
onWindowStageCreate(windowStage: window.WindowStage) {
console.info('onWindowStageCreate');
try {
let windowClass = windowStage.getMainWin... |
release-notes\changelogs\OpenHarmony_5.1.0.56\changelogs-powermgr.md | import { power } from '@kit.BasicServicesKit';
try {
power.wakeup('wakeup_test');
} catch (err) {
if (err.code === 201) {
console.error('wakeup failed, permission verification failed');
} else {
console.error('wakeup failed, err: ' + err);
}
} |
release-notes\changelogs\OpenHarmony_5.1.0.56\changelogs-powermgr.md | import { power } from '@kit.BasicServicesKit';
try {
power.suspend();
} catch (err) {
if (err.code === 201) {
console.error('suspend failed, permission verification failed');
} else {
console.error('suspend failed, err: ' + err);
}
} |
release-notes\changelogs\OpenHarmony_5.1.0.56\changelogs-powermgr.md | import { power } from '@kit.BasicServicesKit';
try {
power.setScreenOffTime(30000);
} catch (err) {
if (err.code === 201) {
console.error('set screen off time failed, permission verification failed');
} else {
console.error('set screen off time failed, err: ' + err);
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.