source stringlengths 14 113 | code stringlengths 10 21.3k |
|---|---|
application-dev\reference\apis-arkui\js-apis-matrix4.md | // xxx.ets
import { matrix4 } from '@kit.ArkUI';
@Entry
@Component
struct Test {
private matrix1 = matrix4.identity().translate({ x: 100 })
// Perform the scale operation on the copy matrix of matrix1, which does not affect matrix1.
private matrix2 = this.matrix1.copy().scale({ x: 2 })
build() {
Column() ... |
application-dev\reference\apis-arkui\js-apis-measure.md | import { MeasureText } from '@kit.ArkUI' |
application-dev\reference\apis-arkui\js-apis-measure.md | import { MeasureText } from '@kit.ArkUI'
@Entry
@Component
struct Index {
@State textWidth: number = MeasureText.measureText({
// You are advised to this.getUIContext().getMeasureUtils().measureText().
textContent: "Hello World",
fontSize: '50px'
})
build() {
Row() {
Column() {
Tex... |
application-dev\reference\apis-arkui\js-apis-measure.md | import { MeasureText } from '@kit.ArkUI'
@Entry
@Component
struct Index {
textSize: SizeOptions = MeasureText.measureTextSize({
// You are advised to this.getUIContext().getMeasureUtils().measureText().
textContent: "Hello World",
fontSize: '50px'
})
build() {
Row() {
Column() {
Te... |
application-dev\reference\apis-arkui\js-apis-mediaquery.md | import { mediaquery } from '@kit.ArkUI'; |
application-dev\reference\apis-arkui\js-apis-mediaquery.md | import { mediaquery } from '@kit.ArkUI';
let listener: mediaquery.MediaQueryListener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events. |
application-dev\reference\apis-arkui\js-apis-mediaquery.md | import { mediaquery } from '@kit.ArkUI';
let listener = mediaquery.matchMediaSync('(orientation: landscape)'); // Listen for landscape events.
function onPortrait(mediaQueryResult:mediaquery.MediaQueryResult) {
if (mediaQueryResult.matches) {
// do something here
} else {
// do something here
}
}
listene... |
application-dev\reference\apis-arkui\js-apis-mediaquery.md | import { mediaquery } from '@kit.ArkUI';
@Entry
@Component
struct MediaQueryExample {
@State color: string = '#DB7093'
@State text: string = 'Portrait'
listener = mediaquery.matchMediaSync('(orientation: landscape)') // You are advised to use this.getUIContext().getMediaQuery().matchMediaSync().
onPortrait(me... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | import { PiPWindow } from '@kit.ArkUI'; |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | let enable: boolean = PiPWindow.isPiPEnabled();
console.info('isPipEnabled:' + enable); |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | import { BusinessError } from '@kit.BasicServicesKit';
import { BuilderNode, FrameNode, NodeController, UIContext } from '@kit.ArkUI';
import { common } from '@kit.AbilityKit';
class Params {
text: string = '';
constructor(text: string) {
this.text = text;
}
}
// You can use the @Builder decorator to constr... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | import { BusinessError } from '@kit.BasicServicesKit';
import { PiPWindow, typeNode, UIContext } from '@kit.ArkUI';
import { common } from '@kit.AbilityKit';
let pipController: PiPWindow.PiPController | undefined = undefined;
let xComponentController: XComponentController = new XComponentController();
let ctx = this.g... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | let promise : Promise<void> = pipController.startPiP();
promise.then(() => {
console.info(`Succeeded in starting pip.`);
}).catch((err: BusinessError) => {
console.error(`Failed to start pip. Cause:${err.code}, message:${err.message}`);
}); |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | let promise : Promise<void> = pipController.stopPiP();
promise.then(() => {
console.info(`Succeeded in stopping pip.`);
}).catch((err: BusinessError) => {
console.error(`Failed to stop pip. Cause:${err.code}, message:${err.message}`);
}); |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | let enable: boolean = true;
pipController.setAutoStartEnabled(enable); |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | let width: number = 540; // The content width changes to 540 px.
let height: number = 960; // The content height changes to 960 px.
pipController.updateContentSize(width, height); |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | let controlType: PiPWindow.PiPControlType = PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE; // Play/Pause component displayed on the video playback control panel.
let status: PiPWindow.PiPControlStatus = PiPWindow.PiPControlStatus.PLAY; // The Play/Pause component displayed on the video playback control panel is in the play... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | import { typeNode, UIContext } from '@kit.ArkUI';
let context: UIContext | undefined = undefined; // You can pass UIContext or use this.getUIContext() in the layout to assign a valid value to context.
try {
let contentNode = typeNode.createNode(context, "XComponent");
pipController.updateContentNode(contentNode);... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | let controlType: PiPWindow.PiPControlType = PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE; // Play/Pause component displayed on the video playback control panel.
let enabled: boolean = false; // The Play/Pause component displayed on the video playback control panel is in the disabled state.
pipController.setPiPControlEnabl... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | let pipWindowInfo: PiPWindow.PiPWindowInfo | undefined = undefined;
try {
let promise : Promise<PiPWindow.PiPWindowInfo> = pipController.getPiPWindowInfo();
promise.then((data) => {
pipWindowInfo = data;
console.info('Success in get pip window info. Info: ' + JSON.stringify(data));
}).catch((err: Business... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | pipController.on('stateChange', (state: PiPWindow.PiPState, reason: string) => {
let curState: string = '';
switch (state) {
case PiPWindow.PiPState.ABOUT_TO_START:
curState = 'ABOUT_TO_START';
break;
case PiPWindow.PiPState.STARTED:
curState = 'STARTED';
break;
case PiPWindow.Pi... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | pipController.off('stateChange'); |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | pipController.on('controlPanelActionEvent', (event: PiPWindow.PiPActionEventType, status?: number) => {
switch (event) {
case 'playbackStateChanged':
if (status === 0) {
// Stop the video.
} else if (status === 1) {
// Play the video.
}
break;
case 'nextVideo':
//... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | pipController.on('controlEvent', (control) => {
switch (control.controlType) {
case PiPWindow.PiPControlType.VIDEO_PLAY_PAUSE:
if (control.status === PiPWindow.PiPControlStatus.PAUSE) {
// Stop the video.
} else if (control.status === PiPWindow.PiPControlStatus.PLAY) {
// Play the vide... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | pipController.off('controlPanelActionEvent'); |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | pipController.off('controlEvent', () => {}); |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | try {
pipController.on('pipWindowSizeChange', (size: PiPWindow.PiPWindowSize) => {
console.info('Succeeded in enabling the listener for pip window size changes. size: ' + JSON.stringify(size));
});
} catch (exception) {
console.error(`Failed to enable the listener for pip window size changes. Cause code: ${ex... |
application-dev\reference\apis-arkui\js-apis-pipWindow.md | const callback = (size: PiPWindow.PiPWindowSize) => {
// ...
}
try {
// Enable listening through the on API.
pipController.on('pipWindowSizeChange', callback);
} catch (exception) {
console.error(`Failed to enable the listener for pip window size changes. Cause code: ${exception.code}, message: ${exception.mess... |
application-dev\reference\apis-arkui\js-apis-plugincomponent-sys.md | import { pluginComponentManager } from '@kit.ArkUI'; |
application-dev\reference\apis-arkui\js-apis-plugincomponent-sys.md | import { pluginComponentManager } from '@kit.ArkUI';
pluginComponentManager.push(
{
owner: {
bundleName: "com.example.provider",
abilityName: "com.example.provider.MainAbility",
},
target: {
bundleName: "com.example.user",
abilityName: "com.example.user.MainAbility",
},
nam... |
application-dev\reference\apis-arkui\js-apis-plugincomponent-sys.md | import { pluginComponentManager } from '@kit.ArkUI';
pluginComponentManager.request(
{
owner: {
bundleName: "com.example.user",
abilityName: "com.example.user.MainAbility",
},
target: {
bundleName: "com.example.provider",
abilityName: "com.example.provider.MainAbility",
},
... |
application-dev\reference\apis-arkui\js-apis-plugincomponent.md | import { pluginComponentManager } from '@kit.ArkUI'; |
application-dev\reference\apis-arkui\js-apis-plugincomponent.md | import { pluginComponentManager, PluginComponentTemplate } from '@kit.ArkUI';
import { Want } from '@kit.AbilityKit';
function onPushListener(source: Want, template: PluginComponentTemplate, data: pluginComponentManager.KVObject, extraData: pluginComponentManager.KVObject) {
console.log("onPushListener template.sour... |
application-dev\reference\apis-arkui\js-apis-plugincomponent.md | import { pluginComponentManager } from '@kit.ArkUI';
import { Want } from '@kit.AbilityKit';
function onRequestListener(source: Want, name: string, data: pluginComponentManager.KVObject) {
console.error("onRequestListener");
console.log("onRequestListener source=" + JSON.stringify(source));
console.log("onReques... |
application-dev\reference\apis-arkui\js-apis-plugincomponent.md | import { pluginComponentManager } from '@kit.ArkUI';
pluginComponentManager.push(
{
want: {
bundleName: "com.example.provider",
abilityName: "com.example.provider.MainAbility",
},
name: "plugintemplate",
data: {
"key_1": "plugin component test",
"key_2": 34234,
},
extra... |
application-dev\reference\apis-arkui\js-apis-plugincomponent.md | import { pluginComponentManager } from '@kit.ArkUI';
pluginComponentManager.request(
{
want: {
bundleName: "com.example.provider",
abilityName: "com.example.provider.MainAbility",
},
name: "plugintemplate",
data: {
"key_1": "plugin component test",
"key_2": 1111111,
},
... |
application-dev\reference\apis-arkui\js-apis-plugincomponent.md | import { pluginComponentManager, PluginComponentTemplate } from '@kit.ArkUI';
import { Want } from '@kit.AbilityKit';
function onPushListener(source:Want, template:PluginComponentTemplate, data:pluginComponentManager.KVObject, extraData:pluginComponentManager.KVObject) {
console.log("onPushListener template.source=" ... |
application-dev\reference\apis-arkui\js-apis-postCardAction.md | Button('Redirect')
.width('40%')
.height('20%')
.onClick(() => {
postCardAction(this, {
action: 'router',
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility',
params: {
message: 'testForRouter' // Customize the message to send.
}
});
})
Button('Sta... |
application-dev\reference\apis-arkui\js-apis-prompt.md | import prompt from '@ohos.prompt' |
application-dev\reference\apis-arkui\js-apis-prompt.md | import prompt from '@ohos.prompt'
prompt.showToast({
message: 'Message Info',
duration: 2000
}); |
application-dev\reference\apis-arkui\js-apis-prompt.md | import prompt from '@ohos.prompt'
prompt.showDialog({
title: 'Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000'
},
{
text: 'button2',
color: '#000000'
}
],
})
.then(data => {
console.info('showDialog success, click button: ' + data... |
application-dev\reference\apis-arkui\js-apis-prompt.md | import prompt from '@ohos.prompt'
prompt.showDialog({
title: 'showDialog Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000'
},
{
text: 'button2',
color: '#000000'
}
]
}, (err, data) => {
if (err) {
console.info('showDialog err: ' + ... |
application-dev\reference\apis-arkui\js-apis-prompt.md | import prompt from '@ohos.prompt'
prompt.showActionMenu({
title: 'Title Info',
buttons: [
{
text: 'item1',
color: '#666666'
},
{
text: 'item2',
color: '#000000'
},
]
}, (err, data) => {
if (err) {
console.info('showActionMenu err: ' + err);
return;
}
console.i... |
application-dev\reference\apis-arkui\js-apis-prompt.md | import prompt from '@ohos.prompt'
prompt.showActionMenu({
title: 'showActionMenu Title Info',
buttons: [
{
text: 'item1',
color: '#666666'
},
{
text: 'item2',
color: '#000000'
},
]
})
.then(data => {
console.info('showActionMenu success, click button: ' + data.index);... |
application-dev\reference\apis-arkui\js-apis-promptAction-sys.md | import { promptAction } from '@kit.ArkUI'; |
application-dev\reference\apis-arkui\js-apis-promptAction.md | import { promptAction } from '@kit.ArkUI'; |
application-dev\reference\apis-arkui\js-apis-promptAction.md | import { promptAction } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct toastExample {
@State toastId: number = 0;
build() {
Column() {
Button('Open Toast')
.height(100)
.type(ButtonType.Capsule)
.onClick(() => {
prompt... |
application-dev\reference\apis-arkui\js-apis-promptAction.md | import { promptAction } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct toastExample {
build() {
Column() {
Button('Show toast').fontSize(20)
.onClick(() => {
try {
promptAction.showToast({
message: 'Hello World'... |
application-dev\reference\apis-arkui\js-apis-promptAction.md | import { promptAction } from '@kit.ArkUI';
promptAction.showDialog({
title: 'Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000'
},
{
text: 'button2',
color: '#000000'
}
],
})
.then(data => {
console.info('showDialog success, click ... |
application-dev\reference\apis-arkui\js-apis-promptAction.md | import { promptAction } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
try {
promptAction.showDialog({
title: 'showDialog Title Info',
message: 'Message Info',
buttons: [
{
text: 'button1',
color: '#000000'
},
{
text: 'button2',
... |
application-dev\reference\apis-arkui\js-apis-promptAction.md | import { promptAction } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
try {
promptAction.showDialog({
title: 'showDialog Title Info',
message: 'Message Info',
isModal: true,
showInSubWindow: true,
buttons: [
{
text: 'button1',
color: '#000000'
... |
application-dev\reference\apis-arkui\js-apis-promptAction.md | import { promptAction } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
try {
promptAction.showActionMenu({
title: 'Title Info',
buttons: [
{
text: 'item1',
color: '#666666'
},
{
text: 'item2',
color: '#000000'
},
]
}, (e... |
application-dev\reference\apis-arkui\js-apis-promptAction.md | import { promptAction } from '@kit.ArkUI';
promptAction.showActionMenu({
title: 'showActionMenu Title Info',
buttons: [
{
text: 'item1',
color: '#666666'
},
{
text: 'item2',
color: '#000000'
},
]
})
.then(data => {
console.info('showActionMenu success, click button: ... |
application-dev\reference\apis-arkui\js-apis-promptAction.md | import { promptAction } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit';
@Entry
@Component
struct Index {
private customDialogComponentId: number = 0;
@Builder
customDialogComponent() {
Column() {
Text('Dialog box').fontSize(30)
Row({ space: 50 }) {
Button("OK").... |
application-dev\reference\apis-arkui\js-apis-promptAction.md | import { LevelMode, ImmersiveMode } from '@kit.ArkUI';
let customDialogId: number = 0;
@Builder
function customDialogBuilder(uiContext: UIContext) {
Column() {
Text('Custom dialog Message').fontSize(10)
Row() {
Button("OK").onClick(() => {
uiContext.getPromptAction().closeCustomDialog(customDi... |
application-dev\reference\apis-arkui\js-apis-promptAction.md | // Index.ets
import { LevelMode, ImmersiveMode } from '@kit.ArkUI';
let customDialogId: number = 0;
@Builder
function customDialogBuilder(uiContext: UIContext) {
Column() {
Text('Custom dialog Message').fontSize(10).height(100)
Row() {
Button("Next").onClick(() => {
uiContext.getRouter().pushU... |
application-dev\reference\apis-arkui\js-apis-promptAction.md | // Next.ets
@Entry
@Component
struct Next {
@State message: string = 'Back';
build() {
Row() {
Column() {
Button(this.message)
.onClick(() => {
this.getUIContext().getRouter().back();
})
}
.width('100%')
}
.height('100%')
}
} |
application-dev\reference\apis-arkui\js-apis-router.md | import { BusinessError } from '@kit.BasicServicesKit';
class innerParams {
data3: number[];
constructor(tuple: number[]) {
this.data3 = tuple;
}
}
class routerParams {
data1: string;
data2: innerParams;
constructor(str: string, tuple: number[]) {
this.data1 = str;
this.data2 = new innerParam... |
application-dev\reference\apis-arkui\js-apis-router.md | class innerParams {
data3: number[];
constructor(tuple: number[]) {
this.data3 = tuple;
}
}
class routerParams {
data1: string;
data2: innerParams;
constructor(str: string, tuple: number[]) {
this.data1 = str;
this.data2 = new innerParams(tuple);
}
}
router.pushUrl({
url: 'pages/routerpa... |
application-dev\reference\apis-arkui\js-apis-router.md | import { BusinessError } from '@kit.BasicServicesKit';
class innerParams {
data3: number[];
constructor(tuple: number[]) {
this.data3 = tuple;
}
}
class routerParams {
data1: string;
data2: innerParams;
constructor(str: string, tuple: number[]) {
this.data1 = str;
this.data2 = new innerParam... |
application-dev\reference\apis-arkui\js-apis-router.md | class innerParams {
data3: number[];
constructor(tuple: number[]) {
this.data3 = tuple;
}
}
class routerParams {
data1: string;
data2: innerParams;
constructor(str: string, tuple: number[]) {
this.data1 = str;
this.data2 = new innerParams(tuple);
}
}
router.pushUrl({
url: 'pages/routerpa... |
application-dev\reference\apis-arkui\js-apis-router.md | import { BusinessError } from '@kit.BasicServicesKit';
class routerParams {
data1: string;
constructor(str: string) {
this.data1 = str;
}
}
router.replaceUrl({
url: 'pages/detail',
params: new routerParams('message')
})
.then(() => {
console.error(`replaceUrl finish`);
})
.catch((err: ESObjec... |
application-dev\reference\apis-arkui\js-apis-router.md | class routerParams {
data1: string;
constructor(str: string) {
this.data1 = str;
}
}
router.replaceUrl({
url: 'pages/detail',
params: new routerParams('message')
}, (err) => {
if (err) {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);
return;
}
console.i... |
application-dev\reference\apis-arkui\js-apis-router.md | import { BusinessError } from '@kit.BasicServicesKit';
class routerParams {
data1:string;
constructor(str:string) {
this.data1 = str;
}
}
router.replaceUrl({
url: 'pages/detail',
params: new routerParams('message')
}, router.RouterMode.Standard)
.then(() => {
console.error(`replaceUrl finish`);
... |
application-dev\reference\apis-arkui\js-apis-router.md | class routerParams {
data1: string;
constructor(str: string) {
this.data1 = str;
}
}
router.replaceUrl({
url: 'pages/detail',
params: new routerParams('message')
}, router.RouterMode.Standard, (err) => {
if (err) {
console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`);... |
application-dev\reference\apis-arkui\js-apis-router.md | import { BusinessError } from '@kit.BasicServicesKit';
class innerParams {
data3: number[];
constructor(tuple: number[]) {
this.data3 = tuple;
}
}
class routerParams {
data1: string;
data2: innerParams;
constructor(str: string, tuple: number[]) {
this.data1 = str;
this.data2 = new innerParam... |
application-dev\reference\apis-arkui\js-apis-router.md | class innerParams {
data3: number[];
constructor(tuple: number[]) {
this.data3 = tuple;
}
}
class routerParams {
data1: string;
data2: innerParams;
constructor(str: string, tuple: number[]) {
this.data1 = str;
this.data2 = new innerParams(tuple);
}
}
router.pushNamedRoute({
name: 'myPage... |
application-dev\reference\apis-arkui\js-apis-router.md | import { BusinessError } from '@kit.BasicServicesKit';
class innerParams {
data3: number[];
constructor(tuple: number[]) {
this.data3 = tuple;
}
}
class routerParams {
data1: string;
data2: innerParams;
constructor(str: string, tuple: number[]) {
this.data1 = str
this.data2 = new innerParams... |
application-dev\reference\apis-arkui\js-apis-router.md | class innerParams {
data3: number[];
constructor(tuple: number[]) {
this.data3 = tuple;
}
}
class routerParams {
data1: string;
data2: innerParams;
constructor(str: string, tuple: number[]) {
this.data1 = str;
this.data2 = new innerParams(tuple);
}
}
router.pushNamedRoute({
name: 'myPage... |
application-dev\reference\apis-arkui\js-apis-router.md | import { BusinessError } from '@kit.BasicServicesKit';
class routerParams {
data1: string;
constructor(str: string) {
this.data1 = str;
}
}
router.replaceNamedRoute({
name: 'myPage',
params: new routerParams('message')
})
.then(() => {
console.error(`replaceNamedRoute finish`);
})
.catch((err... |
application-dev\reference\apis-arkui\js-apis-router.md | class routerParams {
data1: string;
constructor(str: string) {
this.data1 = str;
}
}
router.replaceNamedRoute({
name: 'myPage',
params: new routerParams('message')
}, (err) => {
if (err) {
console.error(`replaceNamedRoute failed, code is ${err.code}, message is ${err.message}`);
return;
}
... |
application-dev\reference\apis-arkui\js-apis-router.md | import { BusinessError } from '@kit.BasicServicesKit';
class routerParams {
data1: string;
constructor(str: string) {
this.data1 = str;
}
}
router.replaceNamedRoute({
name: 'myPage',
params: new routerParams('message')
}, router.RouterMode.Standard)
.then(() => {
console.error(`replaceNamedRoute ... |
application-dev\reference\apis-arkui\js-apis-router.md | class routerParams {
data1: string;
constructor(str: string) {
this.data1 = str;
}
}
router.replaceNamedRoute({
name: 'myPage',
params: new routerParams('message')
}, router.RouterMode.Standard, (err) => {
if (err) {
console.error(`replaceNamedRoute failed, code is ${err.code}, message is ${err.me... |
application-dev\reference\apis-arkui\js-apis-router.md | this.getUIContext().getRouter().back({ url: 'pages/detail' }); |
application-dev\reference\apis-arkui\js-apis-router.md | this.getUIContext().getRouter().back(1); |
application-dev\reference\apis-arkui\js-apis-router.md | this.getUIContext().getRouter().back(1, { info: 'From Home' }); // Returning with parameters. |
application-dev\reference\apis-arkui\js-apis-router.md | this.getUIContext().getRouter().clear(); |
application-dev\reference\apis-arkui\js-apis-router.md | let size = this.getUIContext().getRouter().getLength();
console.log('pages stack size = ' + size); |
application-dev\reference\apis-arkui\js-apis-router.md | let page = this.getUIContext().getRouter().getState();
console.log('current index = ' + page.index);
console.log('current name = ' + page.name);
console.log('current path = ' + page.path); |
application-dev\reference\apis-arkui\js-apis-router.md | let options: router.RouterState | undefined = router.getStateByIndex(1);
if (options != undefined) {
console.log('index = ' + options.index);
console.log('name = ' + options.name);
console.log('path = ' + options.path);
console.log('params = ' + options.params);
} |
application-dev\reference\apis-arkui\js-apis-router.md | let options: Array<router.RouterState> = router.getStateByUrl('pages/index');
for (let i: number = 0; i < options.length; i++) {
console.log('index = ' + options[i].index);
console.log('name = ' + options[i].name);
console.log('path = ' + options[i].path);
console.log('params = ' + options[i].params);
} |
application-dev\reference\apis-arkui\js-apis-router.md | import { BusinessError } from '@kit.BasicServicesKit';
try {
this.getUIContext().getRouter().showAlertBeforeBackPage({
message: 'Message Info'
});
} catch (err) {
console.error(`showAlertBeforeBackPage failed, code is ${(err as BusinessError).code}, message is ${(err as BusinessError).message}`);
} |
application-dev\reference\apis-arkui\js-apis-router.md | this.getUIContext().getRouter().hideAlertBeforeBackPage(); |
application-dev\reference\apis-arkui\js-apis-router.md | this.getUIContext().getRouter().getParams(); |
application-dev\reference\apis-arkui\js-apis-router.md | // Navigate to the target page through router.pushUrl with the params parameter carried.
import { router } from '@kit.ArkUI';
import { BusinessError } from '@kit.BasicServicesKit'
// Define the class for passing parameters.
class innerParams {
array: number[];
constructor(tuple: number[]) {
this.array = tuple... |
application-dev\reference\apis-arkui\js-apis-router.md | // Receive the transferred parameters on the second page.
import { router } from '@kit.ArkUI';
class innerParams {
array: number[];
constructor(tuple: number[]) {
this.array = tuple;
}
}
class routerParams {
text: string;
data: innerParams;
constructor(str: string, tuple: number[]) {
this.text =... |
application-dev\reference\apis-arkui\js-apis-router.md | class innerParams {
data3: number[];
constructor(tuple: number[]) {
this.data3 = tuple;
}
}
class routerParams {
data1: string;
data2: innerParams;
constructor(str: string, tuple: number[]) {
this.data1 = str;
this.data2 = new innerParams(tuple);
}
}
router.push({
url: 'pages/routerpage2... |
application-dev\reference\apis-arkui\js-apis-router.md | class routerParams {
data1: string;
constructor(str: string) {
this.data1 = str;
}
}
router.replace({
url: 'pages/detail',
params: new routerParams('message')
}); |
application-dev\reference\apis-arkui\js-apis-router.md | router.enableAlertBeforeBackPage({
message: 'Message Info'
}); |
application-dev\reference\apis-arkui\js-apis-router.md | router.disableAlertBeforeBackPage(); |
application-dev\reference\apis-arkui\js-apis-screen-sys.md | import { screen } from '@kit.ArkUI'; |
application-dev\reference\apis-arkui\js-apis-screen-sys.md | import { BusinessError } from '@kit.BasicServicesKit';
let screenClass: screen.Screen | null = null;
screen.getAllScreens((err: BusinessError, data: Array<screen.Screen>) => {
const errCode: number = err.code;
if (errCode) {
console.error(`Failed to get all screens. Code:${err.code},message is ${err.message}`)... |
application-dev\reference\apis-arkui\js-apis-screen-sys.md | import { BusinessError } from '@kit.BasicServicesKit';
let screenClass: screen.Screen | null = null;
let promise: Promise<Array<screen.Screen>> = screen.getAllScreens();
promise.then((data: Array<screen.Screen>) => {
screenClass = data[0];
console.log('Succeeded in getting all screens. Data:' + JSON.stringify(data... |
application-dev\reference\apis-arkui\js-apis-screen-sys.md | let callback: Callback<number> = (data: number) => {
console.info('Succeeded in registering the callback for screen changes. Data: ' + JSON.stringify(data))
};
screen.on('connect', callback); |
application-dev\reference\apis-arkui\js-apis-screen-sys.md | let callback: Callback<number> = (data: number) => {
console.info('Succeeded in unregistering the callback for screen changes. Data: ' + JSON.stringify(data))
};
screen.off('connect', callback);
screen.off('connect'); |
application-dev\reference\apis-arkui\js-apis-screen-sys.md | import { BusinessError } from '@kit.BasicServicesKit';
let groupId: number | null = null;
class ExpandOption {
screenId: number = 0;
startX: number = 0;
startY: number = 0;
}
let mainScreenOption: ExpandOption = { screenId: 0, startX: 0, startY: 0 };
let otherScreenOption: ExpandOption = { screenId: 1, startX: 1... |
application-dev\reference\apis-arkui\js-apis-screen-sys.md | import { BusinessError } from '@kit.BasicServicesKit';
class ExpandOption {
screenId: number = 0;
startX: number = 0;
startY: number = 0;
}
let mainScreenOption: ExpandOption = { screenId: 0, startX: 0, startY: 0 };
let otherScreenOption: ExpandOption = { screenId: 1, startX: 1080, startY: 0 };
let expandOptionA... |
application-dev\reference\apis-arkui\js-apis-screen-sys.md | import { BusinessError } from '@kit.BasicServicesKit';
let expandScreenIds: Array<number> = [1, 2, 3];
screen.stopExpand(expandScreenIds, (err: BusinessError) => {
const errCode: number = err.code;
if (errCode) {
console.error(`Failed to stop expand screens. Code:${err.code},message is ${err.message}`);
re... |
application-dev\reference\apis-arkui\js-apis-screen-sys.md | import { BusinessError } from '@kit.BasicServicesKit';
let expandScreenIds: Array<number> = [1, 2, 3];
screen.stopExpand(expandScreenIds).then(() => {
console.info('Succeeded in stopping expand screens.');
}).catch((err: BusinessError) => {
console.error(`Failed to stop expand screens. Code:${err.code},message is ... |
application-dev\reference\apis-arkui\js-apis-screen-sys.md | import { BusinessError } from '@kit.BasicServicesKit';
let mainScreenId: number = 0;
let mirrorScreenIds: Array<number> = [1, 2, 3];
screen.makeMirror(mainScreenId, mirrorScreenIds, (err: BusinessError, data: number) => {
const errCode: number = err.code;
if (errCode) {
console.error(`Failed to set screen mirr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.