source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { let promise = windowClass.moveWindowToGlobal(300, 300); promise.then(() => { console.info('Succeeded in moving the window.'); let rect = windowClass?.getWindowProperties().windowRect; console.info(`Get window rect: ` + JSON.stringify(rect)); ...
application-dev\reference\apis-arkui\js-apis-window.md
import { window } from '@kit.ArkUI'; import { BusinessError } from '@kit.BasicServicesKit'; try { let moveConfiguration: window.MoveConfiguration = { displayId: 0 }; let promise = windowClass.moveWindowToGlobal(300, 300, moveConfiguration); promise.then(() => { console.info('Succeeded in moving the win...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { windowClass.resize(500, 1000, (err: BusinessError) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to change the window size. Cause code: ${err.code}, message: ${err.message}`); return; } console.info...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { let promise = windowClass.resize(500, 1000); promise.then(() => { console.info('Succeeded in changing the window size.'); }).catch((err: BusinessError) => { console.error(`Failed to change the window size. Cause code: ${err.code}, message: ${er...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { let promise = windowClass.resizeAsync(500, 1000); promise.then(() => { console.info('Succeeded in changing the window size.'); let rect = windowClass?.getWindowProperties().windowRect; console.info(`Get window rect: ` + JSON.stringify(rect));...
application-dev\reference\apis-arkui\js-apis-window.md
try { let properties = windowClass.getWindowProperties(); } catch (exception) { console.error(`Failed to obtain the window properties. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
try { let densityInfo = windowClass.getWindowDensityInfo(); } catch (exception) { console.error(`Failed to obtain the window densityInfo. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
try { let rect = windowClass.getGlobalRect(); console.info(`Succeeded in getting window rect: ` + JSON.stringify(rect)); } catch (exception) { console.error(`Failed to get window rect. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
let type = window.AvoidAreaType.TYPE_SYSTEM; try { let avoidArea = windowClass.getWindowAvoidArea(type); } catch (exception) { console.error(`Failed to obtain the area. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; let windowClass: window.Window | undefined = undefined; let config: window.Configuration = { name: "test", windowType: window.WindowType.TYPE_DIALOG, decorEnabled: true, ctx: this.context }; try { window.createWindow(config, (err: BusinessError, data) =>...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; let windowClass: window.Window | undefined = undefined; let config: window.Configuration = { name: "test", windowType: window.WindowType.TYPE_DIALOG, decorEnabled: true, ctx: this.context }; try { window.createWindow(config, (err: BusinessError, data) =>...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { // Load the page corresponding t...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { console.info('onWindowStageCreate'); let windowClass: window.Wind...
application-dev\reference\apis-arkui\js-apis-window.md
try { let enabled = false; windowClass.setImmersiveModeEnabledState(enabled); } catch (exception) { console.error(`Failed to set the window immersive mode enabled status. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
try { let isEnabled = windowClass.getImmersiveModeEnabledState(); } catch (exception) { console.error(`Failed to get the window immersive mode enabled status. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.setWindowDelayRaiseOnDrag(true); } catch (exception) { console.error(`Failed to set window delay raise. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
// The following assumes that all of them are hidden. // EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { console.info('o...
application-dev\reference\apis-arkui\js-apis-window.md
// Here, the status bar is hidden. // EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { console.info('onWindowStageCreate'...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { console.info('onWindowStageCreate'); let windowClass: window.Wind...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage) { let windowClass: window.Window | undefined = undefined; windowStage.ge...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { ColorMetrics, window } from '@kit.ArkUI'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { console.info('onWi...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage) { let windowClass: window.Window | undef...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { console.info('onWindowStageCreate'); let windowClass: window.Wind...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { console.info('onWindowStageCreate'); let windowClass: window.Wind...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage) { console.info('onWindowStageCreate'); let windowClass: window.Window | u...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { window, UIContext } from '@kit.ArkUI'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { onWindowStageCreate(windowStage: window.WindowStage) { // Load content for the main window....
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { windowClass.setUIContent('pages/page2/page3', (err: BusinessError) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to load the content. Cause code: ${err.code}, message: ${err.message}`); return; } co...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { let promise = windowClass.setUIContent('pages/page2/page3'); promise.then(() => { console.info('Succeeded in loading the content.'); }).catch((err: BusinessError) => { console.error(`Failed to load the content. Cause code: ${err.code}, message:...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; let storage: LocalStorage = new LocalStorage(); storage.setOrCreate('storageSimpleProp', 121); windowClass.loadContent('pages/page2', storage, (err: BusinessError) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to load the cont...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; let storage: LocalStorage = new LocalStorage(); storage.setOrCreate('storageSimpleProp', 121); let promise = windowClass.loadContent('pages/page2', storage); promise.then(() => { console.info('Succeeded in loading the content.'); }).catch((err: BusinessError) =>...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; import * as Index from '../pages/Index'; // Import the named route page. console.info('onWindowStageCreate'); let storage: LocalStorage = new LocalStorage(); storage.setOrCreate('storageSimpleProp', 121); try { (windowClass as window.Window).loadContentByName(In...
application-dev\reference\apis-arkui\js-apis-window.md
// ets/pages/Index.ets export const entryName : string = 'Index'; @Entry({routeName: entryName, useSharedStorage: true}) @Component export struct Index { @State message: string = 'Hello World' @LocalStorageLink('storageSimpleProp') storageSimpleProp: number = 1; build() { Row() { Column() { Text...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; import * as Index from '../pages/Index'; // Import the named route page. try { (windowClass as window.Window).loadContentByName(Index.entryName, (err: BusinessError) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to loa...
application-dev\reference\apis-arkui\js-apis-window.md
// ets/pages/Index.ets export const entryName : string = 'Index'; @Entry({routeName: entryName}) @Component export struct Index { @State message: string = 'Hello World' build() { Row() { Column() { Text(this.message) .fontSize(50) .fontWeight(FontWeight.Bold) } .wid...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; import * as Index from '../pages/Index'; // Import the named route page. let storage: LocalStorage = new LocalStorage(); storage.setOrCreate('storageSimpleProp', 121); try { let promise = (windowClass as window.Window).loadContentByName(Index.entryName, storage)...
application-dev\reference\apis-arkui\js-apis-window.md
// ets/pages/Index.ets export const entryName : string = 'Index'; @Entry({routeName: entryName, useSharedStorage: true}) @Component export struct Index { @State message: string = 'Hello World' @LocalStorageLink('storageSimpleProp') storageSimpleProp: number = 1; build() { Row() { Column() { Text...
application-dev\reference\apis-arkui\js-apis-window.md
try { let data = windowClass.isWindowShowing(); console.info('Succeeded in checking whether the window is showing. Data: ' + JSON.stringify(data)); } catch (exception) { console.error(`Failed to check whether the window is showing. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('windowSizeChange', (data) => { console.info('Succeeded in enabling the listener for window size changes. Data: ' + JSON.stringify(data)); }); } catch (exception) { console.error(`Failed to enable the listener for window size changes. Cause code: ${exception.code}, message: ${exception.me...
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (size: window.Size) => { // ... } try { // Enable listening through the on API. windowClass.on('windowSizeChange', callback); // Disable the listening of a specified callback. windowClass.off('windowSizeChange', callback); // Unregister all the callbacks that have been registered through on...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('avoidAreaChange', (data) => { console.info('Succeeded in enabling the listener for system avoid area changes. type:' + JSON.stringify(data.type) + ', area: ' + JSON.stringify(data.area)); }); } catch (exception) { console.error(`Failed to enable the listener for system avoid area cha...
application-dev\reference\apis-arkui\js-apis-window.md
interface Param { type: window.AvoidAreaType, area: window.AvoidArea } const callback = (data: Param) => { // ... } try { windowClass.on('avoidAreaChange', callback); windowClass.off('avoidAreaChange', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('avo...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { windowClass.on('keyboardHeightChange', (data) => { console.info('Succeeded in enabling the listener for keyboard height changes. Data: ' + JSON.stringify(data)); }); } catch (exception) { console.error(`Failed to enable the listener for keyboard he...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; const callback = (height: number) => { // ... } try { windowClass.on('keyboardHeightChange', callback); windowClass.off('keyboardHeightChange', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('keyboardH...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; const callback = (keyboardInfo: window.KeyboardInfo) => { console.info(`Keyboard will show animation. keyboardInfo: ` + JSON.stringify(keyboardInfo)); } try { windowClass.on('keyboardWillShow', callback); console.info(`Register keyboard will show animation s...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; const callback = (keyboardInfo: window.KeyboardInfo) => { console.info(`Keyboard will show animation. keyboardInfo: ` + JSON.stringify(keyboardInfo)); } try { windowClass.on('keyboardWillShow', callback); windowClass.off('keyboardWillShow', callback); // U...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; const callback = (keyboardInfo: window.KeyboardInfo) => { console.info(`Keyboard will hide animation. keyboardInfo: ` + JSON.stringify(keyboardInfo)); } try { windowClass.on('keyboardWillHide', callback); console.info(`Register keyboard will hide animation s...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; const callback = (keyboardInfo: window.KeyboardInfo) => { console.info(`Keyboard will hide animation. keyboardInfo: ` + JSON.stringify(keyboardInfo)); } try { windowClass.on('keyboardWillHide', callback); windowClass.off('keyboardWillHide', callback); // U...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { windowClass.on('keyboardDidShow', (keyboardInfo) => { console.info('keyboard show animation completion. keyboardInfo: ' + JSON.stringify(keyboardInfo)); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.c...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; const callback = (keyboardInfo: window.KeyboardInfo) => { // ... } try { windowClass.on('keyboardDidShow', callback); windowClass.off('keyboardDidShow', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('k...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { windowClass.on('keyboardDidHide', (keyboardInfo) => { console.info('keyboard hide animation completion. keyboardInfo: ' + JSON.stringify(keyboardInfo)); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.c...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; const callback = (keyboardInfo: window.KeyboardInfo) => { // ... } try { windowClass.on('keyboardDidHide', callback); windowClass.off('keyboardDidHide', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('k...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('touchOutside', () => { console.info('touch outside'); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
const callback = () => { // ... } try { windowClass.on('touchOutside', callback); windowClass.off('touchOutside', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('touchOutside'); } catch (exception) { console.error(`Failed to register or unregister callback...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('screenshot', () => { console.info('screenshot happened'); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
let callback = () => { console.info('screenshot happened'); }; try { windowClass.on('screenshot', callback); windowClass.off('screenshot', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('screenshot'); } catch (exception) { console.error(`Failed to register...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('dialogTargetTouch', () => { console.info('touch dialog target'); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
const callback = () => { // ... } try { windowClass.on('dialogTargetTouch', callback); windowClass.off('dialogTargetTouch', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('dialogTargetTouch'); } catch (exception) { console.error(`Failed to register or unre...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('windowEvent', (data) => { console.info('Window event happened. Event:' + JSON.stringify(data)); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (windowEventType: window.WindowEventType) => { // ... } try { // Enable listening through the on API. windowClass.on('windowEvent', callback); // Disable the listening of a specified callback. windowClass.off('windowEvent', callback); // Unregister all the callbacks that have been registere...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('displayIdChange', (data) => { console.info('Window displayId changed, displayId=' + JSON.stringify(data)); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (displayId: number) => { // ... } try { // Enable listening through the on API. windowClass.on('displayIdChange', callback); // Disable the listening of a specified callback. windowClass.off('displayIdChange', callback); // Unregister all the callbacks that have been registered through on()...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('windowVisibilityChange', (boolean) => { console.info('Window visibility changed, isVisible=' + boolean); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (bool: boolean) => { // ... } try { // Enable listening through the on API. windowClass.on('windowVisibilityChange', callback); // Disable the listening of a specified callback. windowClass.off('windowVisibilityChange', callback); // Unregister all the callbacks that have been registered th...
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (density: number) => { console.info('System density changed, density=' + JSON.stringify(density)); } try { windowClass.on('systemDensityChange', callback); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (density: number) => { // ... } try { // Enable listening through the on API. windowClass.on('systemDensityChange', callback); // Disable the listening of a specified callback. windowClass.off('systemDensityChange', callback); // Unregister all the callbacks that have been registered throug...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('noInteractionDetected', 60, () => { console.info('no interaction in 60s'); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
const callback = () => { // ... } try { windowClass.on('noInteractionDetected', 60, callback); windowClass.off('noInteractionDetected', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('noInteractionDetected'); } catch (exception) { console.error(`Failed to ...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('windowStatusChange', (WindowStatusType) => { console.info('Succeeded in enabling the listener for window status changes. Data: ' + JSON.stringify(WindowStatusType)); }); } catch (exception) { console.error(`Failed to unregister callback. Cause code: ${exception.code}, message: ...
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (windowStatusType: window.WindowStatusType) => { // ... } try { windowClass.on('windowStatusChange', callback); windowClass.off('windowStatusChange', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('windowStatusChange'); } catch (ex...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('windowStatusDidChange', (WindowStatusType) => { console.info(`Succeeded in enabling the listener for window status changes. Data: ${JSON.stringify(WindowStatusType)}`); }); } catch (exception) { console.error(`Failed to unregister callback. Cause code: ${exception.code}, messag...
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (windowStatusType: window.WindowStatusType) => { // ... } try { windowClass.on('windowStatusDidChange', callback); windowClass.off('windowStatusDidChange', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('windowStatusDidChange'); } ...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; windowClass?.setUIContent('pages/Index', (error: BusinessError) => { if (error.code) { console.error(`Failed to set the content. Cause code: ${error.code}`); return; } console.info('Succeeded in setting the content.'); let grayScale: number = 0.5; ...
application-dev\reference\apis-arkui\js-apis-window.md
windowClass.setUIContent('pages/WindowPage').then(() => { try { windowClass?.on('windowTitleButtonRectChange', (titleButtonRect) => { console.info('Succeeded in enabling the listener for window title buttons area changes. Data: ' + JSON.stringify(titleButtonRect)); }); } catch (exception) { consol...
application-dev\reference\apis-arkui\js-apis-window.md
windowClass.setUIContent('pages/WindowPage').then(() => { const callback = (titleButtonRect: window.TitleButtonRect) => { // ... } try { // Enable listening through the on API. windowClass?.on('windowTitleButtonRectChange', callback); // Disable the listening of a specified callback. windowClass?....
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('windowRectChange', (data: window.RectChangeOptions) => { console.info(`Succeeded window rect changes. Data: ` + JSON.stringify(data)); }); } catch (exception) { console.error(`Failed to disable the listener for window rect changes. Cause code: ${exception.code}, message: ${exception.me...
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (rectChangeOptions: window.RectChangeOptions) => { // ... } try { windowClass.on('windowRectChange', callback); windowClass.off('windowRectChange', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('windowRectChange'); } catch (exception) { ...
application-dev\reference\apis-arkui\js-apis-window.md
const callback = () => { // ... return true; } try { windowClass.on('subWindowClose', callback); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
const callback = () => { // ... return true; } try { windowClass.on('subWindowClose', callback); windowClass.off('subWindowClose', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('subWindowClose'); } catch (exception) { console.error(`Failed to register o...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { window } from '@kit.ArkUI'; export default class EntryAbility extends UIAbility { onWindowStageCreate(windowStage: window.WindowStage) { console.info('onWindowStageCreate'); const callback = () => { // ... return new Promi...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { window } from '@kit.ArkUI'; export default class EntryAbility extends UIAbility { onWindowStageCreate(windowStage: window.WindowStage) { console.info('onWindowStageCreate'); try { const callback = () => { // ... ...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('windowHighlightChange', (data: boolean) => { console.info(`Window highlight Change: ${data}`); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (data: boolean) => { // ... } try { // Enable listening through the on API. windowClass.on('windowHighlightChange', callback); // Disable the listening of a specified callback. windowClass.off('windowHighlightChange', callback); // Unregister all the callbacks that have been registered thro...
application-dev\reference\apis-arkui\js-apis-window.md
function calculateRect(info: window.RotationChangeInfo): window.Rect { // calculate result with info let rect : window.Rect = { left: 0, top: 0, width: 500, height: 600, } return rect; } const callback = (info: window.RotationChangeInfo): window.RotationChangeResult | void => { ...
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (info: window.RotationChangeInfo): window.RotationChangeResult | void => { // ... return; } try { windowClass.off('rotationChange', callback); // Unregister all the callbacks that have been registered through on(). windowClass.off('rotationChange'); } catch (exception) { console.error(`Fail...
application-dev\reference\apis-arkui\js-apis-window.md
try { windowClass.on('uiExtensionSecureLimitChange', (data: boolean) => { console.info(`Window secure limit Change: ${data}`); }); } catch (exception) { console.error(`Failed to register callback. Cause code: ${exception.code}, message: ${exception.message}`); }
application-dev\reference\apis-arkui\js-apis-window.md
const callback = (data: boolean) => { // ... } try { // Enable listening through the on API. windowClass.on('uiExtensionSecureLimitChange', callback); // Disable the listening of a specified callback. windowClass.off('uiExtensionSecureLimitChange', callback); // Unregister all the callbacks that have been r...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; windowClass.isWindowSupportWideGamut((err: BusinessError, data) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to check whether the window support WideGamut. Cause code: ${err.code}, message: ${err.message}`); return; } ...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; let promise = windowClass.isWindowSupportWideGamut(); promise.then((data) => { console.info(`Succeeded in checking whether the window support WideGamut. Data: ${data}`); }).catch((err: BusinessError) => { console.error(`Failed to check whether the window suppo...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { windowClass.setWindowColorSpace(window.ColorSpace.WIDE_GAMUT, (err: BusinessError) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to set window colorspace. Cause code: ${err.code}, message: ${err.message}`); ...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { let promise = windowClass.setWindowColorSpace(window.ColorSpace.WIDE_GAMUT); promise.then(() => { console.info('Succeeded in setting window colorspace.'); }).catch((err: BusinessError) => { console.error(`Failed to set window colorspace. Cause ...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; try { let colorSpace = windowClass.getWindowColorSpace(); console.info(`Succeeded in getting the window color space. ColorSpace: ${colorSpace}`); } catch (exception) { console.error(`Failed to set the window to be focusable. Cause code: ${exception.code}, me...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; import { ColorMetrics } from '@kit.ArkUI'; let storage: LocalStorage = new LocalStorage(); storage.setOrCreate('storageSimpleProp', 121); windowClass.loadContent("pages/page2", storage, (err: BusinessError) => { let errCode: number = err.code; if (errCode) { ...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { console.info('onWindowStageCreate'); let windowClass: window.Wind...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; export default class EntryAbility extends UIAbility { // ... onWindowStageCreate(windowStage: window.WindowStage): void { console.info('onWindowStageCreate'); let windowClass: window.Wind...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; let isFocusable: boolean = true; try { windowClass.setWindowFocusable(isFocusable, (err: BusinessError) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to set the window to be focusable. Cause code: ${err.code}, message:...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; let isFocusable: boolean = true; try { let promise = windowClass.setWindowFocusable(isFocusable); promise.then(() => { console.info('Succeeded in setting the window to be focusable.'); }).catch((err: BusinessError) => { console.error(`Failed to set t...
application-dev\reference\apis-arkui\js-apis-window.md
// EntryAbility.ets import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { ColorMetrics, window } from '@kit.ArkUI'; try { let promise = window.setStartWindowBackgroundColor("entry", "EntryAbility", ColorMetrics.numeric(0xff000000)); promise.then(() => { ...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; let isKeepScreenOn: boolean = true; try { windowClass.setWindowKeepScreenOn(isKeepScreenOn, (err: BusinessError) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to set the screen to be always on. Cause code: ${err.code},...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; let isKeepScreenOn: boolean = true; try { let promise = windowClass.setWindowKeepScreenOn(isKeepScreenOn); promise.then(() => { console.info('Succeeded in setting the screen to be always on.'); }).catch((err: BusinessError) => { console.error(`Failed...
application-dev\reference\apis-arkui\js-apis-window.md
import { BusinessError } from '@kit.BasicServicesKit'; let isPrivacyMode: boolean = true; try { windowClass.setWindowPrivacyMode(isPrivacyMode, (err: BusinessError) => { const errCode: number = err.code; if (errCode) { console.error(`Failed to set the window to privacy mode. Cause code: ${err.code}, me...