提交 3fecacbc 编写于 作者: 葛亚芳 提交者: Gitee

Merge branch 'master' of gitee.com:openharmony/docs into master

......@@ -195,6 +195,10 @@
- [@ohos.multimodalInput.inputEventClient](js-apis-inputeventclient.md)
- [@ohos.multimodalInput.inputMonitor](js-apis-inputmonitor.md)
- [@ohos.multimodalInput.inputEvent](js-apis-inputevent.md)
- [@ohos.multimodalInput.keyCode](js-apis-keycode.md)
- [@ohos.multimodalInput.keyEvent](js-apis-keyevent.md)
- [@ohos.multimodalInput.mouseEvent](js-apis-mouseevent.md)
- [@ohos.multimodalInput.ToucEvent](js-apis-touchevent.md)
- [@ohos.power](js-apis-power.md)
- [@ohos.runningLock](js-apis-runninglock.md)
- [@ohos.sensor](js-apis-sensor.md)
......
# Keycode
Provides keycodes for a key device.
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import {KeyCode} from '@ohos.multimodalInput.keyCode'
```
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| KEYCODE_FN | number | Yes| No| Function (Fn) key|
| KEYCODE_UNKNOWN | number | Yes| No| Unknown key|
| KEYCODE_HOME | number | Yes| No| Home key |
| KEYCODE_BACK | number | Yes| No| Back key|
| KEYCODE_MEDIA_PLAY_PAUSE | number | Yes| No| Play/Pause key|
| KEYCODE_MEDIA_STOP | number | Yes| No| Stop key|
| KEYCODE_MEDIA_NEXT | number | Yes| No| Next key|
| KEYCODE_MEDIA_PREVIOUS | number | Yes| No| Previous key|
| KEYCODE_MEDIA_REWIND | number | Yes| No| Rewind key|
| KEYCODE_MEDIA_FAST_FORWARD | number | Yes| No| Fast Forward key|
| KEYCODE_VOLUME_UP | number | Yes| No| Volume Up key|
| KEYCODE_VOLUME_DOWN | number | Yes| No| Volume Down key|
| KEYCODE_POWER | number | Yes| No| Power key|
| KEYCODE_CAMERA | number | Yes| No| Camera key|
| KEYCODE_VOLUME_MUTE | number | Yes| No| Speaker Mute key|
| KEYCODE_MUTE | number | Yes| No| Mute key|
| KEYCODE_BRIGHTNESS_UP | number | Yes| No| Brightness Up key|
| KEYCODE_BRIGHTNESS_DOWN | number | Yes| No| Brightness Down key|
| KEYCODE_0 | number | Yes| No| Key 0|
| KEYCODE_1 | number | Yes| No| Key 1|
| KEYCODE_2 | number | Yes| No| Key 2|
| KEYCODE_3 | number | Yes| No| Key 3|
| KEYCODE_4 | number | Yes| No| Key 4|
| KEYCODE_5 | number | Yes| No| Key 5|
| KEYCODE_6 | number | Yes| No| Key 6|
| KEYCODE_7 | number | Yes| No| Key 7|
| KEYCODE_8 | number | Yes| No| Key 8|
| KEYCODE_9 | number | Yes| No| Key 9|
| KEYCODE_STAR | number | Yes| No| Key *|
| KEYCODE_POUND | number | Yes| No| Key #|
| KEYCODE_DPAD_UP | number | Yes| No| Up key on D-pad|
| KEYCODE_DPAD_DOWN | number | Yes| No| Down key on D-pad|
| KEYCODE_DPAD_LEFT | number | Yes| No| Left key on D-pad|
| KEYCODE_DPAD_RIGHT | number | Yes| No| Right key on D-pad|
| KEYCODE_DPAD_CENTER | number | Yes| No| Center key on D-pad|
| KEYCODE_A | number | Yes| No| Key A|
| KEYCODE_B | number | Yes| No| Key B|
| KEYCODE_C | number | Yes| No| Key C|
| KEYCODE_D | number | Yes| No| Key D|
| KEYCODE_E | number | Yes| No| Key E|
| KEYCODE_F | number | Yes| No| Key F|
| KEYCODE_G | number | Yes| No| Key G|
| KEYCODE_H | number | Yes| No| Key H|
| KEYCODE_I | number | Yes| No| Key I|
| KEYCODE_J | number | Yes| No| Key J|
| KEYCODE_K | number | Yes| No| Key K|
| KEYCODE_L | number | Yes| No| Key L|
| KEYCODE_M | number | Yes| No| Key M|
| KEYCODE_N | number | Yes| No| Key N|
| KEYCODE_O | number | Yes| No| Key O|
| KEYCODE_P | number | Yes| No| Key P|
| KEYCODE_Q | number | Yes| No| Key Q|
| KEYCODE_R | number | Yes| No| Key R|
| KEYCODE_S | number | Yes| No| Key S|
| KEYCODE_T | number | Yes| No| Key T|
| KEYCODE_U | number | Yes| No| Key U|
| KEYCODE_V | number | Yes| No| Key V|
| KEYCODE_W | number | Yes| No| Key W|
| KEYCODE_X | number | Yes| No| Key X|
| KEYCODE_Y | number | Yes| No| Key Y|
| KEYCODE_Z | number | Yes| No| Key Z|
| KEYCODE_COMMA | number | Yes| No| Key ,|
| KEYCODE_PERIOD | number | Yes| No| Key .|
| KEYCODE_ALT_LEFT | number | Yes| No| Alt+Left key|
| KEYCODE_ALT_RIGHT | number | Yes| No| Alt+Right key|
| KEYCODE_SHIFT_LEFT | number | Yes| No| Shift+Left key|
| KEYCODE_SHIFT_RIGHT | number | Yes| No| Shift+Right key|
| KEYCODE_TAB | number | Yes| No| Tab key|
| KEYCODE_SPACE | number | Yes| No| Space key|
| KEYCODE_SYM | number | Yes| No| Symbol key|
| KEYCODE_EXPLORER | number | Yes| No| Explorer key, which is used to start the explorer application|
| KEYCODE_ENVELOPE | number | Yes| No| Email key, which is used to start the email application|
| KEYCODE_ENTER | number | Yes| No| Enter key|
| KEYCODE_DEL | number | Yes| No| Delete key|
| KEYCODE_GRAVE | number | Yes| No| Key `|
| KEYCODE_MINUS | number | Yes| No| Key -|
| KEYCODE_EQUALS | number | Yes| No| Key =|
| KEYCODE_LEFT_BRACKET | number | Yes| No| Key [|
| KEYCODE_RIGHT_BRACKET | number | Yes| No| Key ]|
| KEYCODE_BACKSLASH | number | Yes| No| Key \|
| KEYCODE_SEMICOLON | number | Yes| No| Key ;|
| KEYCODE_APOSTROPHE | number | Yes| No| Key ' |
| KEYCODE_SLASH | number | Yes| No| Key /|
| KEYCODE_AT | number | Yes| No| Key @|
| KEYCODE_PLUS | number | Yes| No| Key +|
| KEYCODE_MENU | number | Yes| No| Menu key|
| KEYCODE_PAGE_UP | number | Yes| No| Page Up key|
| KEYCODE_PAGE_DOWN | number | Yes| No| Page Down key|
| KEYCODE_ESCAPE | number | Yes| No| ESC key|
| KEYCODE_FORWARD_DEL | number | Yes| No| Delete key|
| KEYCODE_CTRL_LEFT | number | Yes| No| Control+Left |
| KEYCODE_CTRL_RIGHT | number | Yes| No| Control+Right |
| KEYCODE_CAPS_LOCK | number | Yes| No| Caps Lock key|
| KEYCODE_SCROLL_LOCK | number | Yes| No| Scroll Lock key|
| KEYCODE_META_LEFT | number | Yes| No| Left Meta key|
| KEYCODE_META_RIGHT | number | Yes| No| Right Meta key|
| KEYCODE_FUNCTION | number | Yes| No| Function key|
| KEYCODE_SYSRQ | number | Yes| No| System Request/Print Screen key|
| KEYCODE_BREAK | number | Yes| No| Break/Pause key|
| KEYCODE_MOVE_HOME | number | Yes| No| Move to Home key|
| KEYCODE_MOVE_END | number | Yes| No| Move to End key|
| KEYCODE_INSERT | number | Yes| No| Insert key|
| KEYCODE_FORWARD | number | Yes| No| Delete key |
| KEYCODE_MEDIA_PLAY | number | Yes| No| Play key|
| KEYCODE_MEDIA_PAUSE | number | Yes| No| Pause key|
| KEYCODE_MEDIA_CLOSE | number | Yes| No| Close key|
| KEYCODE_MEDIA_EJECT | number | Yes| No| Eject key|
| KEYCODE_MEDIA_RECORD | number | Yes| No| Record key|
| KEYCODE_F1 | number | Yes| No| F1 key|
| KEYCODE_F2 | number | Yes| No| F2 key|
| KEYCODE_F3 | number | Yes| No| F3 key|
| KEYCODE_F4 | number | Yes| No| F4 key|
| KEYCODE_F5 | number | Yes| No| F5 key|
| KEYCODE_F6 | number | Yes| No| F6 key|
| KEYCODE_F7 | number | Yes| No| F7 key|
| KEYCODE_F8 | number | Yes| No| F8 key|
| KEYCODE_F9 | number | Yes| No| F9 key|
| KEYCODE_F10 | number | Yes| No| F10 key|
| KEYCODE_F11 | number | Yes| No| F11 key|
| KEYCODE_F12 | number | Yes| No| F12 key|
| KEYCODE_NUM_LOCK | number | Yes| No| Number Lock key|
| KEYCODE_NUMPAD_0 | number | Yes| No| Key 0 on numeric keypad|
| KEYCODE_NUMPAD_1 | number | Yes| No| Key 1 on numeric keypad|
| KEYCODE_NUMPAD_2 | number | Yes| No| Key 2 on numeric keypad|
| KEYCODE_NUMPAD_3 | number | Yes| No| Key 3 on numeric keypad|
| KEYCODE_NUMPAD_4 | number | Yes| No| Key 4 on numeric keypad|
| KEYCODE_NUMPAD_5 | number | Yes| No| Key 5 on numeric keypad|
| KEYCODE_NUMPAD_6 | number | Yes| No| Key 6 on numeric keypad|
| KEYCODE_NUMPAD_7 | number | Yes| No| Key 7 on numeric keypad|
| KEYCODE_NUMPAD_8 | number | Yes| No| Key 8 on numeric keypad|
| KEYCODE_NUMPAD_9 | number | Yes| No| Key 9 on numeric keypad|
| KEYCODE_NUMPAD_DIVIDE | number | Yes| No| Key / on numeric keypad|
| KEYCODE_NUMPAD_MULTIPLY | number | Yes| No| Key * on numeric keypad|
| KEYCODE_NUMPAD_SUBTRACT | number | Yes| No| Key - on numeric keypad|
| KEYCODE_NUMPAD_ADD | number | Yes| No| Key + on numeric keypad|
| KEYCODE_NUMPAD_DOT | number | Yes| No| Key . on numeric keypad|
| KEYCODE_NUMPAD_COMMA | number | Yes| No| Key , on numeric keypad|
| KEYCODE_NUMPAD_ENTER | number | Yes| No| Enter key on numeric keypad|
| KEYCODE_NUMPAD_EQUALS | number | Yes| No| Key = on numeric keypad|
| KEYCODE_NUMPAD_LEFT_PAREN | number | Yes| No| Key ( on numeric keypad|
| KEYCODE_NUMPAD_RIGHT_PAREN | number | Yes| No| Key ) on numeric keypad|
| KEYCODE_VIRTUAL_MULTITASK | number | Yes| No| Multi-task key|
| KEYCODE_SLEEP | number | Yes| No| Sleep key|
| KEYCODE_ZENKAKU_HANKAKU | number | Yes| No| Zenkaku/Hankaku key|
| KEYCODE_102ND | number | Yes| No| 102nd key|
| KEYCODE_RO | number | Yes| No| Ro key|
| KEYCODE_KATAKANA | number | Yes| No| Katakana key|
| KEYCODE_HIRAGANA | number | Yes| No| Hiragana key|
| KEYCODE_HENKAN | number | Yes| No| Henkan key|
| KEYCODE_KATAKANA_HIRAGANA | number | Yes| No| Katakana/Hiragana key|
| KEYCODE_MUHENKAN | number | Yes| No| Muhenkan key|
| KEYCODE_LINEFEED | number | Yes| No| Linefeed key|
| KEYCODE_MACRO | number | Yes| No| Macro key|
| KEYCODE_NUMPAD_PLUSMINUS | number | Yes| No| Plus/Minus key on the numeric keypad|
| KEYCODE_SCALE | number | Yes| No| Scale key|
| KEYCODE_HANGUEL | number | Yes| No| Hanguel key|
| KEYCODE_HANJA | number | Yes| No| Hanja key|
| KEYCODE_YEN | number | Yes| No| Yen key|
| KEYCODE_STOP | number | Yes| No| Stop key|
| KEYCODE_AGAIN | number | Yes| No| Again key|
| KEYCODE_PROPS | number | Yes| No| Props key|
| KEYCODE_UNDO | number | Yes| No| Undo key|
| KEYCODE_COPY | number | Yes| No| Copy key|
| KEYCODE_OPEN | number | Yes| No| Open key|
| KEYCODE_PASTE | number | Yes| No| Paste key|
| KEYCODE_FIND | number | Yes| No| Find key|
| KEYCODE_CUT | number | Yes| No| Cut key|
| KEYCODE_HELP | number | Yes| No| Help key|
| KEYCODE_CALC | number | Yes| No| Calc key, which is used to start the calculator application|
| KEYCODE_FILE | number | Yes| No| File key|
| KEYCODE_BOOKMARKS | number | Yes| No| Bookmarks key|
| KEYCODE_NEXT | number | Yes| No| Next key|
| KEYCODE_PLAYPAUSE | number | Yes| No| Play/Pause key|
| KEYCODE_PREVIOUS | number | Yes| No| Previous key|
| KEYCODE_STOPCD | number | Yes| No| Stop CD key|
| KEYCODE_CONFIG | number | Yes| No| Config key|
| KEYCODE_REFRESH | number | Yes| No| Refresh key|
| KEYCODE_EXIT | number | Yes| No| Exit key|
| KEYCODE_EDIT | number | Yes| No| Edit key|
| KEYCODE_SCROLLUP | number | Yes| No| Scroll Up key|
| KEYCODE_SCROLLDOWN | number | Yes| No| Scroll Down key|
| KEYCODE_NEW | number | Yes| No| New key|
| KEYCODE_REDO | number | Yes| No| Redo key|
| KEYCODE_CLOSE | number | Yes| No| Close key|
| KEYCODE_PLAY | number | Yes| No| Play key|
| KEYCODE_BASSBOOST | number | Yes| No| Bass Boost key|
| KEYCODE_PRINT | number | Yes| No| Print key|
| KEYCODE_CHAT | number | Yes| No| Chat key|
| KEYCODE_FINANCE | number | Yes| No| Finance key|
| KEYCODE_CANCEL | number | Yes| No| Cancel key|
| KEYCODE_KBDILLUM_TOGGLE | number | Yes| No| Keyboard Illumination Toggle key|
| KEYCODE_KBDILLUM_DOWN | number | Yes| No| Keyboard Illumination Up key|
| KEYCODE_KBDILLUM_UP | number | Yes| No| Keyboard Illumination Down key|
| KEYCODE_SEND | number | Yes| No| Send key|
| KEYCODE_REPLY | number | Yes| No| Reply key|
| KEYCODE_FORWARDMAIL | number | Yes| No| Forward Mail key|
| KEYCODE_SAVE | number | Yes| No| Save key|
| KEYCODE_DOCUMENTS | number | Yes| No| Documents key|
| KEYCODE_VIDEO_NEXT | number | Yes| No| Next Video key|
| KEYCODE_VIDEO_PREV | number | Yes| No| Previous Video key|
| KEYCODE_BRIGHTNESS_CYCLE | number | Yes| No| Brightness Cycle key|
| KEYCODE_BRIGHTNESS_ZERO | number | Yes| No| Brightness Zero key|
| KEYCODE_DISPLAY_OFF | number | Yes| No| Display Off Key|
| KEYCODE_BTN_MISC | number | Yes| No| Misc Button key|
| KEYCODE_GOTO | number | Yes| No| Goto key|
| KEYCODE_INFO | number | Yes| No| Info key|
| KEYCODE_PROGRAM | number | Yes| No| Program key|
| KEYCODE_PVR | number | Yes| No| PVR key|
| KEYCODE_SUBTITLE | number | Yes| No| Subtitle key|
| KEYCODE_FULL_SCREEN | number | Yes| No| Full Screen key|
| KEYCODE_KEYBOARD | number | Yes| No| Keyboard|
| KEYCODE_ASPECT_RATIO | number | Yes| No| Aspect Ratio key|
| KEYCODE_PC | number | Yes| No| Port Control key|
| KEYCODE_TV | number | Yes| No| TV key|
| KEYCODE_TV2 | number | Yes| No| TV key 2|
| KEYCODE_VCR | number | Yes| No| VCR key|
| KEYCODE_VCR2 | number | Yes| No| VCR key 2|
| KEYCODE_SAT | number | Yes| No| SAT key|
| KEYCODE_CD | number | Yes| No| CD key|
| KEYCODE_TAPE | number | Yes| No| Tape key|
| KEYCODE_TUNER | number | Yes| No| Tuner key|
| KEYCODE_PLAYER | number | Yes| No| Player key|
| KEYCODE_DVD | number | Yes| No| DVD key|
| KEYCODE_AUDIO | number | Yes| No| Audio key|
| KEYCODE_VIDEO | number | Yes| No| Video key|
| KEYCODE_MEMO | number | Yes| No| Memo key|
| KEYCODE_CALENDAR | number | Yes| No| Calendar key|
| KEYCODE_RED | number | Yes| No| Red indicator|
| KEYCODE_GREEN | number | Yes| No| Green indicator|
| KEYCODE_YELLOW | number | Yes| No| Yellow indicator|
| KEYCODE_BLUE | number | Yes| No| Blue indicator|
| KEYCODE_CHANNELUP | number | Yes| No| Channel Up key|
| KEYCODE_CHANNELDOWN | number | Yes| No| Channel Down key|
| KEYCODE_LAST | number | Yes| No| Last key|
| KEYCODE_RESTART | number | Yes| No| Restart key|
| KEYCODE_SLOW | number | Yes| No| Slow key|
| KEYCODE_SHUFFLE | number | Yes| No| Shuffle key|
| KEYCODE_VIDEOPHONE | number | Yes| No| Videophone key|
| KEYCODE_GAMES | number | Yes| No| Games key|
| KEYCODE_ZOOMIN | number | Yes| No| Zoom-in key|
| KEYCODE_ZOOMOUT | number | Yes| No| Zoom-out key|
| KEYCODE_ZOOMRESET | number | Yes| No| Zoom Reset key|
| KEYCODE_WORDPROCESSOR | number | Yes| No| Word Processor key|
| KEYCODE_EDITOR | number | Yes| No| Editor key|
| KEYCODE_SPREADSHEET | number | Yes| No| Spreadsheet key|
| KEYCODE_GRAPHICSEDITOR | number | Yes| No| Graphics Editor key|
| KEYCODE_PRESENTATION | number | Yes| No| Presentation key|
| KEYCODE_DATABASE | number | Yes| No| Database key|
| KEYCODE_NEWS | number | Yes| No| News key|
| KEYCODE_VOICEMAIL | number | Yes| No| Voicemail key|
| KEYCODE_ADDRESSBOOK | number | Yes| No| Addressbook key|
| KEYCODE_MESSENGER | number | Yes| No| Messenger key|
| KEYCODE_BRIGHTNESS_TOGGLE | number | Yes| No| Brightness Toggle key|
| KEYCODE_SPELLCHECK | number | Yes| No| Spell Check key|
| KEYCODE_COFFEE | number | Yes| No| Coffee key, which is used to launch screen lock or screen saver|
| KEYCODE_MEDIA_REPEAT | number | Yes| No| Media Repeat key|
| KEYCODE_IMAGES | number | Yes| No| Images key|
| KEYCODE_BUTTONCONFIG | number | Yes| No| Button Configuration key|
| KEYCODE_TASKMANAGER | number | Yes| No| Task Manager key|
| KEYCODE_JOURNAL | number | Yes| No| Log key|
| KEYCODE_CONTROLPANEL | number | Yes| No| Control Panel key|
| KEYCODE_APPSELECT | number | Yes| No| App Select key|
| KEYCODE_SCREENSAVER | number | Yes| No| Screen Saver key|
| KEYCODE_ASSISTANT | number | Yes| No| Assistant key|
| KEYCODE_KBD_LAYOUT_NEXT | number | Yes| No| Next Keyboard Layout key|
| KEYCODE_BRIGHTNESS_MIN | number | Yes| No| Min Brightness key|
| KEYCODE_BRIGHTNESS_MAX | number | Yes| No| Max Brightness key|
| KEYCODE_KBDINPUTASSIST_PREV | number | Yes| No| Keyboard Input-assisted Previous key|
| KEYCODE_KBDINPUTASSIST_NEXT | number | Yes| No| Keyboard Input-assisted Next key|
| KEYCODE_KBDINPUTASSIST_PREVGROUP | number | Yes| No| Keyboard Input-assisted Previous Group key|
| KEYCODE_KBDINPUTASSIST_NEXTGROUP | number | Yes| No| Keyboard Input-assisted Next Group key|
| KEYCODE_KBDINPUTASSIST_ACCEPT | number | Yes| No| Keyboard Input-assisted Accept key|
| KEYCODE_KBDINPUTASSIST_CANCEL | number | Yes| No| Keyboard Input-assisted Cancel key|
| KEYCODE_FRONT | number | Yes| No| Front key, which is used to launch the windshield defogger|
| KEYCODE_SETUP | number | Yes| No| Setup key|
| KEYCODE_WAKEUP | number | Yes| No| Wakeup key|
| KEYCODE_SENDFILE | number | Yes| No| Send File key|
| KEYCODE_DELETEFILE | number | Yes| No| Delete File key|
| KEYCODE_XFER | number | Yes| No| XFER key, which is used to start file transfer|
| KEYCODE_PROG1 | number | Yes| No| Program key 1|
| KEYCODE_PROG2 | number | Yes| No| Program key 2|
| KEYCODE_MSDOS | number | Yes| No| MS-DOS key|
| KEYCODE_SCREENLOCK | number | Yes| No| Screen Lock key|
| KEYCODE_DIRECTION_ROTATE_DISPLAY | number | Yes| No| Directional Rotation Display key|
| KEYCODE_CYCLEWINDOWS | number | Yes| No| Windows Cycle key|
| KEYCODE_COMPUTER | number | Yes| No| Computer key|
| KEYCODE_EJECTCLOSECD | number | Yes| No| Eject CD key|
| KEYCODE_ISO | number | Yes| No| ISO key|
| KEYCODE_MOVE | number | Yes| No| Move key|
| KEYCODE_F13 | number | Yes| No| F13 key|
| KEYCODE_F14 | number | Yes| No| F14 key|
| KEYCODE_F15 | number | Yes| No| F15 key|
| KEYCODE_F16 | number | Yes| No| F16 key|
| KEYCODE_F17 | number | Yes| No| F17 key|
| KEYCODE_F18 | number | Yes| No| F18 key|
| KEYCODE_F19 | number | Yes| No| F19 key|
| KEYCODE_F20 | number | Yes| No| F20 key|
| KEYCODE_F21 | number | Yes| No| F21 key|
| KEYCODE_F22 | number | Yes| No| F22 key|
| KEYCODE_F23 | number | Yes| No| F23 key|
| KEYCODE_F24 | number | Yes| No| F24 key|
| KEYCODE_PROG3 | number | Yes| No| Program key 3|
| KEYCODE_PROG4 | number | Yes| No| Program key 4|
| KEYCODE_DASHBOARD | number | Yes| No| Dashboard|
| KEYCODE_SUSPEND | number | Yes| No| Suspend key|
| KEYCODE_HP | number | Yes| No| HP key|
| KEYCODE_SOUND | number | Yes| No| Sound key|
| KEYCODE_QUESTION | number | Yes| No| Question key|
| KEYCODE_CONNECT | number | Yes| No| Connect key|
| KEYCODE_SPORT | number | Yes| No| Sport key|
| KEYCODE_SHOP | number | Yes| No| Shop key|
| KEYCODE_ALTERASE | number | Yes| No| Alternate key|
| KEYCODE_SWITCHVIDEOMODE | number | Yes| No| Switch Video Mode key (monitor, LCD, and TV, etc.)|
| KEYCODE_BATTERY | number | Yes| No| Battery key|
| KEYCODE_BLUETOOTH | number | Yes| No| Bluetooth key|
| KEYCODE_WLAN | number | Yes| No| WLAN key|
| KEYCODE_UWB | number | Yes| No| Ultra-wideband key|
| KEYCODE_WWAN_WIMAX | number | Yes| No| WWAN WiMAX key|
| KEYCODE_RFKILL | number | Yes| No| RF Kill key|
| KEYCODE_CHANNEL | number | Yes| No| Channel key|
| KEYCODE_BTN_0 | number | Yes| No| Key 0|
| KEYCODE_BTN_1 | number | Yes| No| Button 1|
| KEYCODE_BTN_2 | number | Yes| No| Button 2|
| KEYCODE_BTN_3 | number | Yes| No| Button 3|
| KEYCODE_BTN_4 | number | Yes| No| Button 4|
| KEYCODE_BTN_5 | number | Yes| No| Button 5|
| KEYCODE_BTN_6 | number | Yes| No| Button 6|
| KEYCODE_BTN_7 | number | Yes| No| Button 7|
| KEYCODE_BTN_8 | number | Yes| No| Button 8|
| KEYCODE_BTN_9 | number | Yes| No| Button 9|
# Key Event
Represents key events reported by an input device.
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import {Action,Key,KeyEvent} from '@ohos.multimodalInput.keyEvent';
```
## Action
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| CANCEL | number | Yes| No| Cancellation of a key action.|
| DOWN | number | Yes| No| Pressing of a key.|
| UP | number | Yes| No| Release of a key.|
## Key
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| code | KeyCode | Yes| No| Keycode.|
| pressedTime | number | Yes| No| Time when the key is pressed.|
| deviceId | number | Yes| No| Device to which the key belongs.|
## KeyEvent
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| action | Action | Yes| No| Key action.|
| key | Key | Yes| No| Key that has changed.|
| unicodeChar | number | Yes| No| Unicode character corresponding to the key.|
| keys | Key[] | Yes| No| List of pressed keys.|
| ctrlKey | boolean | Yes| No| Whether ctrlKey is being pressed.|
| altKey | boolean | Yes| No| Whether altKey is being pressed.|
| shiftKey | boolean | Yes| No| Whether shiftKey is being pressed.|
| logoKey | boolean | Yes| No| Whether logoKey is being pressed.|
| fnKey | boolean | Yes| No| Whether fnKey is being pressed.|
| capsLock | boolean | Yes| No| Whether capsLock is active.|
| numLock | boolean | Yes| No| Whether numLock is active.|
| scrollLock | boolean | Yes| No| Whether scrollLock is active.|
# Mouse Event
Represents mouse events reported by an input device.
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import {Action,Button,Axis,AxisValue,MouseEvent} from '@ohos.multimodalInput.mouseEvent';
```
## Action
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| CANCEL | number | Yes| No| Cancellation of a mouse action.|
| MOVE | number | Yes| No| Moving of the mouse pointer.|
| BUTTON_DOWN | number | Yes| No| Pressing of a mouse button.|
| BUTTON_UP | number | Yes| No| Release of a mouse button.|
| AXIS_BEGIN | number | Yes| No| Beginning of the axis event associated with the mouse.|
| AXIS_UPDATE | number | Yes| No| Updating of the axis event associated with the mouse.|
| AXIS_END | number | Yes| No| Ending of the axis event associated with the mouse.|
## Button
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| LEFT | number | Yes| No| Left button on the mouse.|
| MIDDLE | number | Yes| No| Middle button on the mouse.|
| RIGHT | number | Yes| No| Right button on the mouse.|
| SIDE | number | Yes| No| Side button on the mouse.|
| EXTRA | number | Yes| No| Extended button on the mouse.|
| FORWARD | number | Yes| No| Forward button on the mouse.|
| BACK | number | Yes| No| Back button on the mouse.|
| TASK | number | Yes| No| Task button on the mouse.|
## Axis
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| SCROLL_VERTICAL | number | Yes| No| Vertical scroll axis.|
| SCROLL_HORIZONTAL | number | Yes| No| Horizontal scroll axis.|
| PINCH | number | Yes| No| Pinch axis.|
## AxisValue
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| axis | Axis | Yes| No| Axis type.|
| value | number | Yes| No| Axis value.|
## MouseEvent
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| action | Action | Yes| No| Mouse event action.|
| screenX | number | Yes| No| X coordinate of the mouse pointer on the screen.|
| screenY | number | Yes| No| Y coordinate of the mouse pointer on the screen.|
| windowX | number | Yes| No| X coordinate of the mouse pointer in the window.|
| windowY | number | Yes| No| Y coordinate of the mouse pointer in the window.|
| rawDeltaX | number | Yes| No| X axis offset relative to the previous reported mouse pointer position. When the mouse pointer is at the edge of the screen, the value may be less than the difference of the X coordinate reported twice.|
| rawDeltaY | number | Yes| No| Y axis offset relative to the previous reported mouse pointer position.|
| button | Button | Yes| No| Button that is currently pressed or released.|
| pressedButtons | Button[] | Yes| No| Button that is being pressed.|
| axes | AxisValue[] | Yes| No| All axis data contained in the event.|
| pressedKeys | KeyCode[] | Yes| No| List of pressed keys.|
| ctrlKey | boolean | Yes| No| Whether ctrlKey is being pressed.|
| altKey | boolean | Yes| No| Whether altKey is being pressed.|
| shiftKey | boolean | Yes| No| Whether shiftKey is being pressed.|
| logoKey | boolean | Yes| No| Whether logoKey is being pressed.|
| fnKey | boolean | Yes| No| Whether fnKey is being pressed.|
| capsLock | boolean | Yes| No| Whether capsLock is active.|
| numLock | boolean | Yes| No| Whether numLock is active.|
| scrollLock | boolean | Yes| No| Whether scrollLock is active.|
# Touch Event
Represents touch events reported by an input device.
> **NOTE**<br>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
```js
import {Action,ToolType,SourceType,Touch,TouchEvent} from '@ohos.multimodalInput.touchEvent';
```
## Action
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| CANCEL | number | Yes| No| Cancellation of the touch action.|
| DOWN | number | Yes| No| Pressing of touch.|
| MOVE | number | Yes| No| Moving of touch.|
| UP | number | Yes| No| Lifting of touch.|
## ToolType
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| FINGER | number | Yes| No| Finger|
| PEN | number | Yes| No| Pen|
| RUBBER | number | Yes| No| Eraser|
| BRUSH | number | Yes| No| Brush|
| PENCIL | number | Yes| No| Pencil|
| AIRBRUSH | number | Yes| No| Air brush|
| MOUSE | number | Yes| No| Mouse|
| LENS | number | Yes| No| Lens|
## SourceType
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| TOUCH_SCREEN | number | Yes| No| Touchscreen|
| PEN | number | Yes| No| Stylus|
| TOUCH_PAD | number | Yes| No| Touchpad|
## Touch
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| id | number | Yes| No| Pointer ID.|
| pressedTime | number | Yes| No| Time stamp when touch is pressed.|
| screenX | number | Yes| No| X coordinate of the touch position on the screen.|
| screenY | number | Yes| No| Y coordinate of the touch position on the screen.|
| windowX | number | Yes| No| X coordinate of the touch position in the window.|
| windowY | number | Yes| No| Y coordinate of the touch position in the window.|
| pressure | number | Yes| No| Pressure value. The value range is [0.0, 1.0]. The value 0.0 indicates that the pressure is not supported.|
| width | number | Yes| No| Width of the contact area where touch is pressed.|
| height | number | Yes| No| Height of the contact area where touch is pressed.|
| tiltX | number | Yes| No| Angle relative to the YZ plane. The value range is [-90, 90]. A positive value indicates a rightward tilt.|
| tiltY | number | Yes| No| Angle relative to the XZ plane. The value range is [-90, 90]. A positive value indicates a downward tilt.|
| toolX | number | Yes| No| Center point X of the tool area.|
| toolY | number | Yes| No| Center point Y of the tool area.|
| toolWidth | number | Yes| No| Width of the tool area.|
| toolHeight | number | Yes| No| Height of the tool area.|
| rawX | number | Yes| No| X coordinate of the input device.|
| rawY | number | Yes| No| Y coordinate of the input device.|
| toolType | number | Yes| No| Tool type.|
## TouchEvent
**System capability**: SystemCapability.MultimodalInput.Input.Core
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| action | Action | Yes| No| Touch action.|
| touch | Touch | Yes| No| Current touch point.|
| touches | Touch[] | Yes| No| All touch points.|
| sourceType | SourceType | Yes| No| Device type of the touch source.|
......@@ -78,29 +78,29 @@ Ability功能如下(Ability类,具体的API详见[接口文档](../reference
onCreate(want, launchParam) {
console.log("MainAbility onCreate")
}
onDestroy() {
console.log("MainAbility onDestroy")
}
onWindowStageCreate(windowStage) {
console.log("MainAbility onWindowStageCreate")
windowStage.loadContent("pages/index").then((data) => {
console.log("MainAbility load content succeed with data: " + JSON.stringify(data))
}).catch((error) => {
console.error("MainAbility load content failed with error: " + JSON.stringify(error))
})
}
onWindowStageDestroy() {
console.log("MainAbility onWindowStageDestroy")
}
onForeground() {
console.log("MainAbility onForeground")
}
onBackground() {
console.log("MainAbility onBackground")
}
......@@ -210,14 +210,14 @@ Ability类拥有context属性,context属性为AbilityContext类,AbilityConte
**表3** AbilityContext API接口功能介绍
|接口名|描述|
|:------|:------|
|startAbility(want: Want, callback: AsyncCallback<void>): void|启动Ability。|
|startAbility(want: Want, options?: StartOptions): Promise<void>|启动Ability。|
|startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback<void>): void|带AccountId启动Ability。|
|startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<void>|带AccountId启动Ability。|
|startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void|带返回结果启动Ability。|
|startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityResult>|带返回结果启动Ability。|
|startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback<AbilityResult>): void|带返回结果及AccountId启动Ability。|
|startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise<AbilityResult>|带返回结果及AccountId启动Ability。|
|startAbility(want: Want, callback: AsyncCallback\<void>): void|启动Ability。|
|startAbility(want: Want, options?: StartOptions): Promise\<void>|启动Ability。|
|startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<void>): void|带AccountId启动Ability。|
|startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\<void>|带AccountId启动Ability。|
|startAbilityForResult(want: Want, callback: AsyncCallback\<AbilityResult>): void|带返回结果启动Ability。|
|startAbilityForResult(want: Want, options?: StartOptions): Promise\<AbilityResult>|带返回结果启动Ability。|
|startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback\<AbilityResult>): void|带返回结果及AccountId启动Ability。|
|startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\<AbilityResult>|带返回结果及AccountId启动Ability。|
### 相同设备启动Ability
应用可以通过`this.context`获取Ability实例的上下文,进而使用AbilityContext中的StartAbility相关接口启动Ability。启动Ability可指定Want、StartOptions、accountId,通过callback形式或promise形式实现。具体示例代码如下:
```ts
......
......@@ -18,11 +18,11 @@ Caller及Callee功能如下:具体的API详见[接口文档](../reference/apis
**表1** Call API接口功能介绍
|接口名|描述|
|:------|:------|
|startAbilityByCall(want: Want): Promise<Caller>|获取指定通用组件的Caller通信接口,拉起指定通用组件并将其切换到后台。|
|startAbilityByCall(want: Want): Promise\<Caller>|获取指定通用组件的Caller通信接口,拉起指定通用组件并将其切换到后台。|
|on(method: string, callback: CaleeCallBack): void|通用组件Callee注册method对应的callback方法。|
|off(method: string): void|通用组件Callee去注册method的callback方法。|
|call(method: string, data: rpc.Sequenceable): Promise<void>|向通用组件Callee发送约定序列化数据。|
|callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>|向通用组件Callee发送约定序列化数据, 并将返回的约定序列化数据带回。|
|call(method: string, data: rpc.Sequenceable): Promise\<void>|向通用组件Callee发送约定序列化数据。|
|callWithResult(method: string, data: rpc.Sequenceable): Promise\<rpc.MessageParcel>|向通用组件Callee发送约定序列化数据, 并将返回的约定序列化数据带回。|
|release(): void|释放通用组件的Caller通信接口。|
|onRelease(callback: OnReleaseCallBack): void|注册通用组件通信断开监听通知。|
......
......@@ -71,6 +71,8 @@
| 类名 | 接口名 | 描述 |
| -------- | -------- | -------- |
| DistributedDataObject | save(deviceId: string): Promise&lt;SaveSuccessResponse&gt; | 保存数据对象。 |
| DistributedDataObject| save(deviceId: string, callback: AsyncCallback&lt;SaveSuccessResponse&gt;): void | 保存数据对象。 |
| DistributedDataObject | revokeSave(callback: AsyncCallback&lt;RevokeSaveSuccessResponse&gt;): void | 撤回已保存的数据对象。 |
| DistributedDataObject| revokeSave(): Promise&lt;RevokeSaveSuccessResponse&gt; | 撤回已保存的数据对象。 |
## 开发步骤
......@@ -201,6 +203,9 @@
```
10. 保存和撤回已保存的数据对象。
1.callback方式
```js
// 保存数据对象
local_object.save("local", (result, data)=>{
......@@ -215,23 +220,31 @@
console.info("revokeSave sessionId " + data.sessionId);
});
```
2.Promise方式
```js
// 保存数据对象
g_object.save("local").then((result)=>{
console.info("save sessionId " + result.sessionId);
console.info("save version " + result.version);
console.info("save deviceId " + result.deviceId);
}, (result)=>{
console.info("save local failed.");
});
// 撤回保存的数据对象
g_object.revokeSave().then((result)=>{
console.info("revokeSave success.");
}, (result)=>{
console.info("revokeSave failed.");
});
```
11. 删除监听分布式对象的上下线。可以指定删除监听的上下线回调;也可以不指定,这将会删除该分布式数据对象的所有上下线回调。
以下为取消监听数据变更的代码示例:
```js
// 保存数据对象
g_object.save("local", (result)=>{
console.log("save callback");
console.info("save sessionId " + result.sessionId);
console.info("save version " + result.version);
console.info("save deviceId " + result.deviceId);
});
// 撤回保存的数据对象
g_object.revokeSave((result, data) =>{
console.log("revokeSave callback");
});
//删除上下线回调statusCallback
local_object.off("status", this.statusCallback);
//删除所有的上下线回调
local_object.off("status");
```
12. 退出同步组网。分布式对象退出组网后,本地的数据变更对端不会同步。
......@@ -241,10 +254,10 @@
```
## 开发实例
针对分布式数据对象,有以下开发实例可供参考:
针对分布式数据对象,有以下开发实例可供参考:
- [备忘录应用](https://gitee.com/openharmony/distributeddatamgr_objectstore/tree/master/samples/distributedNotepad)
在备忘录应用中,当某一个设备上的备忘录事件发生变更时,通过分布式数据对象将事件变更同步在可信组网内的其他设备上,比如新增备忘录事件、编辑事件标题和内容、清空事件列表等。
......@@ -186,7 +186,7 @@
| 类名 | 接口名 | 描述 |
| -------- | -------- | -------- |
| RdbStore |off(event:'dataChange', type: SubscribeType, observer: Callback\<Array\<string>>): void| 从数据库中删除指定类型的指定观察者,结果以callback形式返回。<br/>-&nbsp;type:指在{@code SubscribeType}中定义的订阅类型;SUBSCRIBE_TYPE_REMOTE 订阅远程数据更改。<br/>-&nbsp;observer:指已注册的数据更改观察者。 |
| RdbStore |off(event:'dataChange', type: SubscribeType, observer: Callback\<Array\<string>>): void;| 从数据库中删除指定类型的指定观察者,结果以callback形式返回。<br/>-&nbsp;type:指在{@code SubscribeType}中定义的订阅类型;SUBSCRIBE_TYPE_REMOTE 订阅远程数据更改。<br/>-&nbsp;observer:指已注册的数据更改观察者。 |
## 开发步骤
......
......@@ -2,5 +2,5 @@
- [公共事件与通知概述](notification-brief.md)
- [公共事件开发指导](common-event.md)
- [通知开发指导](notification.md)
- [通知开发指导](notification-guidelines.md)
- [调试助手使用指导](assistant-guidelines.md)
\ No newline at end of file
# Notification开发指导
# 通知开发指导
## 场景简介
......@@ -34,8 +34,8 @@ OpenHarmony通过ANS(Advanced Notification Service,通知系统服务)对
| 接口名 | 描述 |
| ------------------------------------------------------------ | ---------------- |
| isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback<boolean>): void | 查询通知使能开关 |
| enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback<void>): void | 设置使能开关 |
| isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean>): void | 查询通知使能开关 |
| enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void | 设置使能开关 |
用于查询和设置通知使能开关,若某个应用的通知使能关闭状态,则无法发送通知。
......@@ -45,9 +45,9 @@ OpenHarmony通过ANS(Advanced Notification Service,通知系统服务)对
| 接口名 | 描述 |
| ------------------------------------------------------------ | ---------------- |
| subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback<void>): void | 订阅指定应用通知 |
| subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void | 订阅所有通知 |
| unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback<void>): void | 取消订阅通知 |
| subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback\<void>): void | 订阅指定应用通知 |
| subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void>): void | 订阅所有通知 |
| unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void>): void | 取消订阅通知 |
订阅接口有支持订阅所有通知、或订阅某些应用的通知。
......@@ -69,10 +69,10 @@ OpenHarmony通过ANS(Advanced Notification Service,通知系统服务)对
| 接口名 | 描述 |
| ------------------------------------------------------------ | ------------------------ |
| publish(request: NotificationRequest, callback: AsyncCallback<void>): void | 发布通知 |
| publish(request: NotificationRequest, userId: number, callback: AsyncCallback<void>): void | 指定用户发布通知 |
| cancel(id: number, label: string, callback: AsyncCallback<void>): void | 取消指定的通知 |
| cancelAll(callback: AsyncCallback<void>): void; | 取消所有该应用发布的通知 |
| publish(request: NotificationRequest, callback: AsyncCallback\<void>): void | 发布通知 |
| publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<void>): void | 指定用户发布通知 |
| cancel(id: number, label: string, callback: AsyncCallback\<void>): void | 取消指定的通知 |
| cancelAll(callback: AsyncCallback\<void>): void; | 取消所有该应用发布的通知 |
携带userId的publish接口,可以指定向该用户下订阅者发布通知。
......
......@@ -495,7 +495,7 @@ bundle.getAllApplicationInfo(bundleFlags, (err, data) => {
## bundle.getBundleArchiveInfo
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise<BundleInfo>
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise\<BundleInfo>
以异步方法获取有关HAP包中包含的应用程序包的信息,使用Promise形式返回结果。
......@@ -530,7 +530,7 @@ bundle.getBundleArchiveInfo(hapFilePath, bundleFlags)
## bundle.getBundleArchiveInfo
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback<BundleInfo>) : void
getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>) : void
以异步方法获取有关HAP包中包含的应用程序包的信息,使用callback形式返回结果。
......
......@@ -931,9 +931,9 @@ Hap模块信息
| iconId | number | 是 | 否 | 模块图标ID。 |
| backgroundImg | string | 是 | 否 | 模块背景图片。 |
| supportedModes | number | 是 | 否 | 模块支持的模式。 |
| reqCapabilities | Array<string> | 是 | 否 | 模块运行需要的能力。 |
| deviceTypes | Array<string> | 是 | 否 | 支持运行的设备类型。 |
| abilityInfo | Array<AbilityInfo> | 是 | 否 | Ability信息。 |
| reqCapabilities | Array\<string> | 是 | 否 | 模块运行需要的能力。 |
| deviceTypes | Array\<string> | 是 | 否 | 支持运行的设备类型。 |
| abilityInfo | Array\<AbilityInfo> | 是 | 否 | Ability信息。 |
| moduleName | string | 是 | 否 | 模块名。 |
| mainAbilityName | string | 是 | 否 | 入口Ability名称。 |
| installationFree | boolean | 是 | 否 | 是否支持免安装。 |
......
......@@ -542,7 +542,7 @@ audio.createAudioCapturer(audioCapturerOptions).then((data) => {
| ---------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
| actionType | [InterruptActionType](#interruptactiontype) | 是 | 事件返回类型。TYPE_ACTIVATED为焦点触发事件,TYPE_INTERRUPT为音频打断事件。 |
| type | [InterruptType](#interrupttype) | 否 | 打断事件类型。 |
| hint | [InterruptHint](interrupthint) | 否 | 打断事件提示。 |
| hint | [InterruptHint](#interrupthint) | 否 | 打断事件提示。 |
| activated | boolean | 否 | 获得/释放焦点。true表示焦点获取/释放成功,false表示焦点获得/释放失败。 |
## VolumeEvent<sup>8+</sup>
......
......@@ -720,7 +720,7 @@ bluetooth.off('stateChange', onReceiveEvent);
```
## bluetooth.sppListen<sup>8+</sup><a name="sppListen<"></a>
## bluetooth.sppListen<sup>8+</sup><a name="sppListen"></a>
sppListen(name: string, option: SppOption, callback: AsyncCallback&lt;number&gt;): void
......@@ -1330,7 +1330,7 @@ let ret = a2dpSrc.getDeviceState('XX:XX:XX:XX:XX:XX');
使用A2dpSourceProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。
### connect<sup>8+</sup><a name="connect"></a>
### connect<sup>8+</sup><a name="a2dp-connect"></a>
connect(device: string): boolean
......@@ -1360,7 +1360,7 @@ let ret = a2dpSrc.connect('XX:XX:XX:XX:XX:XX');
```
### disconnect<sup>8+</sup><a name="disconnect"></a>
### disconnect<sup>8+</sup><a name="a2dp-disconnect"></a>
disconnect(device: string): boolean
......@@ -1484,7 +1484,7 @@ let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX');
使用HandsFreeAudioGatewayProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。
### connect<sup>8+</sup><a name="connect"></a>
### connect<sup>8+</sup><a name="hfp-connect"></a>
connect(device: string): boolean
......@@ -1514,7 +1514,7 @@ let ret = hfpAg.connect('XX:XX:XX:XX:XX:XX');
```
### disconnect<sup>8+</sup><a name="disconnect"></a>
### disconnect<sup>8+</sup><a name="hfp-disconnect"></a>
disconnect(device: string): boolean
......
......@@ -6,7 +6,7 @@
> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## **导入模块**
## 导入模块
```
import cardEmulation from '@ohos.nfc.cardEmulation';
......
......@@ -891,7 +891,7 @@ call(uri: string, method: string, arg: string, extras: PacMap): Promise\<PacMap>
| 类型 | 说明 |
|------ | ------- |
|Promise<[PacMap](#pacmap)> | 调用的返回值。 |
|Promise\<[PacMap](#pacmap)> | 调用的返回值。 |
**示例:**
......@@ -922,7 +922,7 @@ call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCa
| method | string | 是 | 被调用的方法名。 |
| arg | string | 是 |需传入的参数。 |
| extras | [PacMap](#pacmap) | 是 | 键值对参数。 |
| callback | AsyncCallback<[PacMap](#pacmap)> | 是 | 返回值。 |
| callback | AsyncCallback\<[PacMap](#pacmap)> | 是 | 返回值。 |
**示例:**
......
......@@ -104,7 +104,7 @@ inputDevice.getDeviceIds((ids)=>{
## inputDevice.getDeviceIds
function getDeviceIds(): Promise&lt;&lt;Array&lt;number&gt;&gt;
getDeviceIds(): Promise&lt;Array&lt;number&gt;&gt;
获取所有输入设备的id列表,使用Promise方式作为异步方法。
......@@ -150,7 +150,7 @@ inputDevice.getDevice(1, (inputDevice)=>{
## inputDevice.getDevice
function getDevice(deviceId: number): Promise&lt;InputDeviceData&gt;
getDevice(deviceId: number): Promise&lt;InputDeviceData&gt;
获取输入设备的描述信息,使用Promise方式作为异步方法。
......@@ -333,15 +333,15 @@ inputDevice.getKeyboardType(1).then((ret)=>{
**系统能力**: 以下各项对应的系统能力均为SystemCapability.MultimodalInput.Input.InputDevice
| 名称 | 参数类型 | 说明 |
| ----------------------- | ------------------------- | -------- |
| 名称 | 参数类型 | 说明 |
| ----------------------- | ------------------------- | ---------------- |
| source | [SourceType](#sourcetype) | 轴的输入源类型。 |
| axis | [AxisType](axistype) | 轴的类型。 |
| max | number | 轴的最大值。 |
| min | number | 轴的最小值。 |
| fuzz<sup>9+</sup> | number | 轴的模糊值。 |
| flat<sup>9+</sup> | number | 轴的基准值。 |
| resolution<sup>9+</sup> | number | 轴的分辨率。 |
| axis | [AxisType](#axistype) | 轴的类型。 |
| max | number | 轴的最大值。 |
| min | number | 轴的最小值。 |
| fuzz<sup>9+</sup> | number | 轴的模糊值。 |
| flat<sup>9+</sup> | number | 轴的基准值。 |
| resolution<sup>9+</sup> | number | 轴的分辨率。 |
## SourceType
......
......@@ -716,9 +716,9 @@ setDisplaySurface(surfaceId: string): Promise\<void>
**返回值:**
| 类型 | 说明 |
| ------------- | ------------------------------ |
| Promise<void> | 设置SurfaceId的Promise返回值。 |
| 类型 | 说明 |
| -------------- | ------------------------------ |
| Promise\<void> | 设置SurfaceId的Promise返回值。 |
**示例:**
......
......@@ -1956,7 +1956,7 @@ async function example() {
实体相册
### **属性**
### 属性
**系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core
......
......@@ -2354,7 +2354,7 @@ Notification.enableDistributedByBundle(bundle, enable, enableDistributedByBundle
## Notification.enableDistributedByBundle<sup>8+</sup>
根据bundleenableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise<void>
bundleenableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise\<void>
根据应用的包设置应用程序是否支持分布式通知(Promise形式)。
......
......@@ -208,7 +208,7 @@ showActionMenu(options: ActionMenuOptions, callback: AsyncCallback&lt;ActionMenu
## prompt.showActionMenu
showActionMenu(options: ActionMenuOptions): Promise<ActionMenuSuccessResponse>
showActionMenu(options: ActionMenuOptions): Promise\<ActionMenuSuccessResponse>
创建并显示操作菜单,菜单响应后同步返回结果。
......
......@@ -14,7 +14,7 @@ import resourceManager from '@ohos.resourceManager';
## 使用说明
从API Version9开始,Stage模型支持了通过context获取resourceManager对象的方式,再调用其接口,无需再导入包。
从API Version9开始,Stage模型支持了通过context获取resourceManager对象的方式,再调用其接口,无需再导入包,此方式FA模型不适用
```
this.context.resourceManager;
......@@ -26,6 +26,8 @@ getResourceManager(callback: AsyncCallback&lt;ResourceManager&gt;): void
获取当前应用的资源管理对象,使用callback形式返回ResourceManager对象。
此接口仅可在FA模型下使用。
**系统能力**:SystemCapability.Global.ResourceManager
**参数:**
......@@ -57,6 +59,8 @@ getResourceManager(bundleName: string, callback: AsyncCallback&lt;ResourceManage
获取指定应用的资源管理对象,使用callback形式返回ResourceManager对象。
此接口仅可在FA模型下使用。
**系统能力**:SystemCapability.Global.ResourceManager
**参数:**
......@@ -78,6 +82,8 @@ getResourceManager(): Promise&lt;ResourceManager&gt;
获取当前应用的资源管理对象,使用Promise形式返回ResourceManager对象。
此接口仅可在FA模型下使用。
**系统能力**:SystemCapability.Global.ResourceManager
**返回值:**
......@@ -107,6 +113,8 @@ getResourceManager(bundleName: string): Promise&lt;ResourceManager&gt;
获取指定应用的资源管理对象,使用Promise形式返回ResourceManager对象。
此接口仅可在FA模型下使用。
**系统能力**:SystemCapability.Global.ResourceManager
**参数:**
......@@ -644,7 +652,7 @@ getPluralString(resId: number, num: number): Promise&lt;string&gt;
getRawFile(path: string, callback: AsyncCallback&lt;Uint8Array&gt;): void
用户获取指定路径对应的rawfile文件内容,使用callback形式返回字节数组。
用户获取resources/rawfile目录下对应的rawfile文件内容,使用callback形式返回字节数组。
**系统能力**:SystemCapability.Global.ResourceManager
......@@ -671,7 +679,7 @@ getRawFile(path: string, callback: AsyncCallback&lt;Uint8Array&gt;): void
getRawFile(path: string): Promise&lt;Uint8Array&gt;
用户获取指定路径对应的rawfile文件内容,使用Promise形式返回字节数组。
用户获取resources/rawfile目录下对应的rawfile文件内容,使用Promise形式返回字节数组。
**系统能力**:SystemCapability.Global.ResourceManager
......@@ -700,7 +708,7 @@ getRawFile(path: string): Promise&lt;Uint8Array&gt;
getRawFileDescriptor(path: string, callback: AsyncCallback&lt;RawFileDescriptor&gt;): void
用户获取指定路径对应的rawfile文件的descriptor,使用callback形式返回。
用户获取resources/rawfile目录下对应rawfile文件的descriptor,使用callback形式返回。
**系统能力**:SystemCapability.Global.ResourceManager
......@@ -729,7 +737,7 @@ getRawFileDescriptor(path: string, callback: AsyncCallback&lt;RawFileDescriptor&
getRawFileDescriptor(path: string): Promise&lt;RawFileDescriptor&gt;
用户获取指定路径对应的rawfile文件的descriptor,使用Promise形式返回。
用户获取resources/rawfile目录下对应rawfile文件的descriptor,使用Promise形式返回。
**系统能力**:SystemCapability.Global.ResourceManager
......@@ -760,7 +768,7 @@ getRawFileDescriptor(path: string): Promise&lt;RawFileDescriptor&gt;
closeRawFileDescriptor(path: string, callback: AsyncCallback&lt;void&gt;): void
用户关闭指定路径打开的rawfile文件的descriptor,使用callback形式返回。
用户关闭resources/rawfile目录下rawfile文件的descriptor,使用callback形式返回。
**系统能力**:SystemCapability.Global.ResourceManager
......@@ -785,7 +793,7 @@ closeRawFileDescriptor(path: string, callback: AsyncCallback&lt;void&gt;): void
closeRawFileDescriptor(path: string): Promise&lt;void&gt;
用户关闭指定路径打开的rawfile文件的descriptor,使用Promise形式返回。
用户关闭resources/rawfile目录下rawfile文件的descriptor,使用Promise形式返回。
**系统能力**:SystemCapability.Global.ResourceManager
......@@ -821,11 +829,7 @@ release()
**示例:**
```
resourceManager.getResourceManager((error, mgr) => {
mgr.release((error, value) => {
if (error != null) {
console.log("error is " + error);
}
});
mgr.release();
});
```
......
......@@ -22,13 +22,13 @@ JS FA应用的JS模块(entry/src/main/js/module)的典型开发目录结构如
各个文件夹的作用:
- app.js文件用于全局JavaScript逻辑和应用生命周期管理,详见[app.js](../ui/js-framework-js-file.md)
- app.js文件用于全局JavaScript逻辑和应用生命周期管理,详见[app.js](js-framework-js-file.md)
- pages目录用于存放所有组件页面。
- common目录用于存放公共资源文件,比如:媒体资源,自定义组件和JS文件。
- resources目录用于存放资源配置文件,比如:多分辨率加载等配置文件,详见[资源限定与访问](../ui/js-framework-resource-restriction.md)章节。
- resources目录用于存放资源配置文件,比如:多分辨率加载等配置文件,详见[资源限定与访问](js-framework-resource-restriction.md)章节。
- share目录用于配置多个实例共享的资源内容,比如:share中的图片和JSON文件可被default1和default2实例共享。
......
......@@ -22,15 +22,15 @@ import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility';
接口名 | 接口描述
---------------------------------------------------------|-----------------------------------------
function startWork(work: WorkInfo): boolean; | 延迟调度任务申请
function stopWork(work: WorkInfo, needCancel?: boolean): boolean; | 延迟调度任务取消
function getWorkStatus(workId: number, callback: AsyncCallback<WorkInfo>): void;| 获取延迟调度任务状态(Callback形式)
function getWorkStatus(workId: number): Promise<WorkInfo>; | 获取延迟调度任务状态(Promise形式)
function obtainAllWorks(callback: AsyncCallback<void>): Array<WorkInfo>;| 获取所有延迟调度任务(Callback形式)
function obtainAllWorks(): Promise<Array<WorkInfo>>;| 获取所有延迟调度任务(Promise形式)
function stopAndClearWorks(): boolean;| 停止并清除任务
function isLastWorkTimeOut(workId: number, callback: AsyncCallback<void>): boolean;| 获取上次任务是否超时(针对RepeatWork,Callback形式)
function isLastWorkTimeOut(workId: number): Promise<boolean>;| 获取上次任务是否超时(针对RepeatWork,Promise形式)
startWork(work: WorkInfo): boolean; | 延迟调度任务申请
stopWork(work: WorkInfo, needCancel?: boolean): boolean; | 延迟调度任务取消
getWorkStatus(workId: number, callback: AsyncCallback\<WorkInfo>): void;| 获取延迟调度任务状态(Callback形式)
getWorkStatus(workId: number): Promise\<WorkInfo>; | 获取延迟调度任务状态(Promise形式)
obtainAllWorks(callback: AsyncCallback\<void>): Array\<WorkInfo>;| 获取所有延迟调度任务(Callback形式)
obtainAllWorks(): Promise<Array\<WorkInfo>>;| 获取所有延迟调度任务(Promise形式)
stopAndClearWorks(): boolean;| 停止并清除任务
isLastWorkTimeOut(workId: number, callback: AsyncCallback\<void>): boolean;| 获取上次任务是否超时(针对RepeatWork,Callback形式)
isLastWorkTimeOut(workId: number): Promise\<boolean>;| 获取上次任务是否超时(针对RepeatWork,Promise形式)
**表2** WorkInfo包含参数
......@@ -53,15 +53,15 @@ repeatCount |循环次数| number
接口名 | 接口描述
---------------------------------------------------------|-----------------------------------------
function onWorkStart(work: WorkInfo): void; | 延迟调度任务开始回调
function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调
onWorkStart(work: WorkInfo): void; | 延迟调度任务开始回调
onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调
### 开发步骤
**开发对应的Extension**
import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility';
export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStart(workInfo) {
console.log('MyWorkSchedulerExtensionAbility onWorkStart' + JSON.stringify(workInfo));
......@@ -74,10 +74,8 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调
**注册延迟任务**
import workScheduler from '@ohos.workScheduler';
let workInfo = {
workId: 1,
batteryLevel:50,
......@@ -95,7 +93,7 @@ function onWorkStop(work: WorkInfo): void; | 延迟调度任务结束回调
import workScheduler from '@ohos.workScheduler';
let workInfo = {
workId: 1,
batteryLevel:50,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册