1/* 2 * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit BasicServicesKit 19 */ 20 21import { Callback } from './@ohos.base'; 22 23/** 24 * Provides methods for sending and processing in-process events. 25 * 26 * @namespace emitter 27 * @syscap SystemCapability.Notification.Emitter 28 * @since 7 29 */ 30/** 31 * Provides methods for sending and processing in-process events. 32 * 33 * @namespace emitter 34 * @syscap SystemCapability.Notification.Emitter 35 * @atomicservice 36 * @since 11 37 */ 38/** 39 * Provides methods for sending and processing in-process events. 40 * 41 * @namespace emitter 42 * @syscap SystemCapability.Notification.Emitter 43 * @crossplatform 44 * @atomicservice 45 * @since arkts {'1.1':'12', '1.2':'20'} 46 * @arkts 1.1&1.2 47 */ 48declare namespace emitter { 49 /** 50 * Subscribes to an event in persistent manner and executes a callback after the event is received. 51 * 52 * @param { InnerEvent } event - Event to subscribe to in persistent manner. The EventPriority parameter is not required and does not take effect. 53 * @param { Callback<EventData> } callback - Callback to be executed when the event is received. 54 * @syscap SystemCapability.Notification.Emitter 55 * @since 7 56 */ 57 /** 58 * Subscribes to an event in persistent manner and executes a callback after the event is received. 59 * 60 * @param { InnerEvent } event - Event to subscribe to in persistent manner. The EventPriority parameter is not required and does not take effect. 61 * @param { Callback<EventData> } callback - Callback to be executed when the event is received. 62 * @syscap SystemCapability.Notification.Emitter 63 * @atomicservice 64 * @since 11 65 */ 66 /** 67 * Subscribes to an event in persistent manner and executes a callback after the event is received. 68 * 69 * @param { InnerEvent } event - Event to subscribe to in persistent manner. The EventPriority parameter is not required and does not take effect. 70 * @param { Callback<EventData> } callback - Callback to be executed when the event is received. 71 * @syscap SystemCapability.Notification.Emitter 72 * @crossplatform 73 * @atomicservice 74 * @since arkts {'1.1':'12', '1.2':'20'} 75 * @arkts 1.1&1.2 76 */ 77 function on(event: InnerEvent, callback: Callback<EventData>): void; 78 79 /** 80 * Subscribes to an event in persistent manner and executes a callback after the event is received. 81 * 82 * @param { string } eventId - Event to subscribe to in persistent manner. The value cannot be an empty string and exceed 10240 bytes. 83 * @param { Callback<EventData> } callback - Callback to be executed when the event is received. 84 * @syscap SystemCapability.Notification.Emitter 85 * @atomicservice 86 * @since 11 87 */ 88 /** 89 * Subscribes to an event in persistent manner and executes a callback after the event is received. 90 * 91 * @param { string } eventId - Event to subscribe to in persistent manner. The value cannot be an empty string and exceed 10240 bytes. 92 * @param { Callback<EventData> } callback - Callback to be executed when the event is received. 93 * @syscap SystemCapability.Notification.Emitter 94 * @crossplatform 95 * @atomicservice 96 * @since arkts {'1.1':'12', '1.2':'20'} 97 * @arkts 1.1&1.2 98 */ 99 function on(eventId: string, callback: Callback<EventData>): void; 100 101 /** 102 * Subscribes to an event in persistent manner and executes a callback after the event is received. 103 * 104 * @param { string } eventId - Event to subscribe to in persistent manner. The value cannot be an empty string and exceed 10240 bytes. 105 * @param { Callback<GenericEventData<T>> } callback - Callback to be executed when the event is received. 106 * @syscap SystemCapability.Notification.Emitter 107 * @crossplatform 108 * @atomicservice 109 * @since arkts {'1.1':'12', '1.2':'20'} 110 * @arkts 1.1&1.2 111 */ 112 function on<T>(eventId: string, callback: Callback<GenericEventData<T>>): void; 113 114 /** 115 * Subscribe to a event by specific id in persistent manner and receives the event callback. 116 * 117 * @param { string } eventId - indicate ID of the event to subscribe to. 118 * @param { Callback<EventData> | Callback<GenericEventData<T>> } callback - indicate callback used to receive the event. 119 * @syscap SystemCapability.Notification.Emitter 120 * @crossplatform 121 * @atomicservice 122 * @since 20 123 * @arkts 1.2 124 */ 125 function on<T>(eventId: string, callback: Callback<EventData> | Callback<GenericEventData<T>>): void; 126 127 /** 128 * Subscribes to an event in one-shot manner and unsubscribes from it after the event callback is executed. 129 * 130 * @param { InnerEvent } event - Event to subscribe to in one-shot manner. The EventPriority parameter is not required and does not take effect. 131 * @param { Callback<EventData> } callback - Callback to be executed when the event is received. 132 * @syscap SystemCapability.Notification.Emitter 133 * @since 7 134 */ 135 /** 136 * Subscribes to an event in one-shot manner and unsubscribes from it after the event callback is executed. 137 * 138 * @param { InnerEvent } event - Event to subscribe to in one-shot manner. The EventPriority parameter is not required and does not take effect. 139 * @param { Callback<EventData> } callback - Callback to be executed when the event is received. 140 * @syscap SystemCapability.Notification.Emitter 141 * @atomicservice 142 * @since 11 143 */ 144 /** 145 * Subscribes to an event in one-shot manner and unsubscribes from it after the event callback is executed. 146 * 147 * @param { InnerEvent } event - Event to subscribe to in one-shot manner. The EventPriority parameter is not required and does not take effect. 148 * @param { Callback<EventData> } callback - Callback to be executed when the event is received. 149 * @syscap SystemCapability.Notification.Emitter 150 * @crossplatform 151 * @atomicservice 152 * @since arkts {'1.1':'12', '1.2':'20'} 153 * @arkts 1.1&1.2 154 */ 155 function once(event: InnerEvent, callback: Callback<EventData>): void; 156 157 /** 158 * Subscribes to an event in one-shot manner and unsubscribes from it after the event callback is executed. 159 * 160 * @param { string } eventId - Event to subscribe to in one-shot manner. The value cannot be an empty string and exceed 10240 bytes. 161 * @param { Callback<EventData> } callback - Callback to be executed when the event is received. 162 * @syscap SystemCapability.Notification.Emitter 163 * @atomicservice 164 * @since 11 165 */ 166 /** 167 * Subscribes to an event in one-shot manner and unsubscribes from it after the event callback is executed. 168 * 169 * @param { string } eventId - Event to subscribe to in one-shot manner. The value cannot be an empty string and exceed 10240 bytes. 170 * @param { Callback<EventData> } callback - Callback to be executed when the event is received. 171 * @syscap SystemCapability.Notification.Emitter 172 * @crossplatform 173 * @atomicservice 174 * @since arkts {'1.1':'12', '1.2':'20'} 175 * @arkts 1.1&1.2 176 */ 177 function once(eventId: string, callback: Callback<EventData>): void; 178 179 /** 180 * Subscribes to an event in one-shot manner and unsubscribes from it after the event callback is executed. 181 * 182 * @param { string } eventId - Event to subscribe to in one-shot manner. The value cannot be an empty string and exceed 10240 bytes. 183 * @param { Callback<GenericEventData<T>> } callback - Callback to be executed when the event is received. 184 * @syscap SystemCapability.Notification.Emitter 185 * @crossplatform 186 * @atomicservice 187 * @since arkts {'1.1':'12', '1.2':'20'} 188 * @arkts 1.1&1.2 189 */ 190 function once<T>(eventId: string, callback: Callback<GenericEventData<T>>): void; 191 192 /** 193 * Unsubscribes from all events with the specified event ID. 194 * 195 * @param { number } eventId - Event ID. 196 * @syscap SystemCapability.Notification.Emitter 197 * @since 7 198 */ 199 /** 200 * Unsubscribes from all events with the specified event ID. 201 * 202 * @param { number } eventId - Event ID. 203 * @syscap SystemCapability.Notification.Emitter 204 * @atomicservice 205 * @since 11 206 */ 207 /** 208 * Unsubscribes from all events with the specified event ID. 209 * 210 * @param { number } eventId - Event ID. 211 * @syscap SystemCapability.Notification.Emitter 212 * @crossplatform 213 * @atomicservice 214 * @since arkts {'1.1':'12', '1.2':'20'} 215 * @arkts 1.1&1.2 216 */ 217 function off(eventId: number): void; 218 219 /** 220 * Unsubscribes from all events with the specified event ID. 221 * 222 * @param { string } eventId - Event ID. The value cannot be an empty string and exceed 10240 bytes. 223 * @syscap SystemCapability.Notification.Emitter 224 * @atomicservice 225 * @since 11 226 */ 227 /** 228 * Unsubscribes from all events with the specified event ID. 229 * 230 * @param { string } eventId - Event ID. The value cannot be an empty string and exceed 10240 bytes. 231 * @syscap SystemCapability.Notification.Emitter 232 * @crossplatform 233 * @atomicservice 234 * @since arkts {'1.1':'12', '1.2':'20'} 235 * @arkts 1.1&1.2 236 */ 237 function off(eventId: string): void; 238 239 /** 240 * Unsubscribes from an event with the specified event ID and processed by the specified callback. 241 * This API takes effect only when Callback<EventData> has been registered through the on or once API. 242 * Otherwise, no processing is performed. 243 * 244 * @param { number } eventId - Event ID. 245 * @param { Callback<EventData> } callback - Callback to unregister. 246 * @syscap SystemCapability.Notification.Emitter 247 * @since 10 248 */ 249 /** 250 * Unsubscribes from an event with the specified event ID and processed by the specified callback. 251 * This API takes effect only when Callback<EventData> has been registered through the on or once API. 252 * Otherwise, no processing is performed. 253 * 254 * @param { number } eventId - Event ID. 255 * @param { Callback<EventData> } callback - Callback to unregister. 256 * @syscap SystemCapability.Notification.Emitter 257 * @atomicservice 258 * @since 11 259 */ 260 /** 261 * Unsubscribes from an event with the specified event ID and processed by the specified callback. 262 * This API takes effect only when Callback<EventData> has been registered through the on or once API. 263 * Otherwise, no processing is performed. 264 * 265 * @param { number } eventId - Event ID. 266 * @param { Callback<EventData> } callback - Callback to unregister. 267 * @syscap SystemCapability.Notification.Emitter 268 * @crossplatform 269 * @atomicservice 270 * @since arkts {'1.1':'12', '1.2':'20'} 271 * @arkts 1.1&1.2 272 */ 273 function off(eventId: number, callback: Callback<EventData>): void; 274 275 /** 276 * Unsubscribes from an event with the specified event ID and processed by the specified callback. 277 * This API takes effect only when Callback<EventData> has been registered through the on or once API. 278 * Otherwise, no processing is performed. 279 * 280 * @param { string } eventId - Event ID. The value cannot be an empty string and exceed 10240 bytes. 281 * @param { Callback<EventData> } callback - Callback to unregister. 282 * @syscap SystemCapability.Notification.Emitter 283 * @atomicservice 284 * @since 11 285 */ 286 /** 287 * Unsubscribes from an event with the specified event ID and processed by the specified callback. 288 * This API takes effect only when Callback<EventData> has been registered through the on or once API. 289 * Otherwise, no processing is performed. 290 * 291 * @param { string } eventId - Event ID. The value cannot be an empty string and exceed 10240 bytes. 292 * @param { Callback<EventData> } callback - Callback to unregister. 293 * @syscap SystemCapability.Notification.Emitter 294 * @crossplatform 295 * @atomicservice 296 * @since arkts {'1.1':'12', '1.2':'20'} 297 * @arkts 1.1&1.2 298 */ 299 function off(eventId: string, callback: Callback<EventData>): void; 300 301 /** 302 * Unsubscribes from an event with the specified event ID and processed by the specified callback. 303 * This API takes effect only when Callback<EventData> has been registered through the on or once API. 304 * Otherwise, no processing is performed. 305 * 306 * @param { string } eventId - Event ID. The value cannot be an empty string and exceed 10240 bytes. 307 * @param { Callback<GenericEventData<T>> } callback - Callback to unregister. 308 * @syscap SystemCapability.Notification.Emitter 309 * @crossplatform 310 * @atomicservice 311 * @since arkts {'1.1':'12', '1.2':'20'} 312 * @arkts 1.1&1.2 313 */ 314 function off<T>(eventId: string, callback: Callback<GenericEventData<T>>): void; 315 316 /** 317 * Unsubscribe specified callback function from an event. 318 * 319 * @param { string } eventId - indicates ID of the event to unsubscribe from. 320 * @param { Callback<EventData> | Callback<GenericEventData<T>> } callback - indicates callback used to receive the event. 321 * @syscap SystemCapability.Notification.Emitter 322 * @crossplatform 323 * @atomicservice 324 * @since 20 325 * @arkts 1.2 326 */ 327 function off<T>(eventId: string, callback: Callback<EventData> | Callback<GenericEventData<T>>): void; 328 329 /** 330 * Emits the specified event. 331 * 332 * @param { InnerEvent } event - Event to emit, where EventPriority specifies the emit priority of the event. 333 * @param { EventData } [data] - Data passed in the event. 334 * @syscap SystemCapability.Notification.Emitter 335 * @since 7 336 */ 337 /** 338 * Emits the specified event. 339 * 340 * @param { InnerEvent } event - Event to emit, where EventPriority specifies the emit priority of the event. 341 * @param { EventData } [data] - Data passed in the event. 342 * @syscap SystemCapability.Notification.Emitter 343 * @atomicservice 344 * @since 11 345 */ 346 /** 347 * Emits the specified event. 348 * 349 * @param { InnerEvent } event - Event to emit, where EventPriority specifies the emit priority of the event. 350 * @param { EventData } [data] - Data passed in the event. 351 * @syscap SystemCapability.Notification.Emitter 352 * @crossplatform 353 * @atomicservice 354 * @since arkts {'1.1':'12', '1.2':'20'} 355 * @arkts 1.1&1.2 356 */ 357 function emit(event: InnerEvent, data?: EventData): void; 358 359 /** 360 * Emits the specified event. 361 * 362 * @param { string } eventId - ID of the event to emit. The value cannot be an empty string and exceed 10240 bytes. 363 * @param { EventData } [data] - Data passed in the event. 364 * @syscap SystemCapability.Notification.Emitter 365 * @atomicservice 366 * @since 11 367 */ 368 /** 369 * Emits the specified event. 370 * 371 * @param { string } eventId - ID of the event to emit. The value cannot be an empty string and exceed 10240 bytes. 372 * @param { EventData } [data] - Data passed in the event. 373 * @syscap SystemCapability.Notification.Emitter 374 * @crossplatform 375 * @atomicservice 376 * @since arkts {'1.1':'12', '1.2':'20'} 377 * @arkts 1.1&1.2 378 */ 379 function emit(eventId: string, data?: EventData): void; 380 381 /** 382 * Emits the specified event. 383 * 384 * @param { string } eventId - ID of the event to emit. The value cannot be an empty string and exceed 10240 bytes. 385 * @param { GenericEventData<T> } [data] - Data passed in the event. 386 * @syscap SystemCapability.Notification.Emitter 387 * @crossplatform 388 * @atomicservice 389 * @since arkts {'1.1':'12', '1.2':'20'} 390 * @arkts 1.1&1.2 391 */ 392 function emit<T>(eventId: string, data?: GenericEventData<T>): void; 393 394 /** 395 * Emits an event by specific id to the event queue. 396 * 397 * @param { string } eventId - indicate ID of the event to emit. 398 * @param { EventData | GenericEventData<T> } [data] - indicate data carried by the event. 399 * @syscap SystemCapability.Notification.Emitter 400 * @crossplatform 401 * @atomicservice 402 * @since 20 403 * @arkts 1.2 404 */ 405 function emit<T>(eventId: string, data?: EventData | GenericEventData<T>): void; 406 407 /** 408 * Emits an event of a specified priority. 409 * 410 * @param { string } eventId - ID of the event to emit. The value cannot be an empty string and exceed 10240 bytes. 411 * @param { Options } options - Event emit priority. 412 * @param { EventData } [data] - Data passed in the event. 413 * @syscap SystemCapability.Notification.Emitter 414 * @atomicservice 415 * @since 11 416 */ 417 /** 418 * Emits an event of a specified priority. 419 * 420 * @param { string } eventId - ID of the event to emit. The value cannot be an empty string and exceed 10240 bytes. 421 * @param { Options } options - Event emit priority. 422 * @param { EventData } [data] - Data passed in the event. 423 * @syscap SystemCapability.Notification.Emitter 424 * @crossplatform 425 * @atomicservice 426 * @since arkts {'1.1':'12', '1.2':'20'} 427 * @arkts 1.1&1.2 428 */ 429 function emit(eventId: string, options: Options, data?: EventData): void; 430 431 /** 432 * Emits an event of a specified priority. 433 * 434 * @param { string } eventId - ID of the event to emit. The value cannot be an empty string and exceed 10240 bytes. 435 * @param { Options } options - Event emit priority. 436 * @param { GenericEventData<T> } [data] - Data passed in the event. 437 * @syscap SystemCapability.Notification.Emitter 438 * @crossplatform 439 * @atomicservice 440 * @since arkts {'1.1':'12', '1.2':'20'} 441 * @arkts 1.1&1.2 442 */ 443 function emit<T>(eventId: string, options: Options, data?: GenericEventData<T>): void; 444 445 /** 446 * Obtains the number of subscriptions to a specified event. 447 * 448 * @param { number | string } eventId - Event ID. The value of the string type cannot be an empty string. 449 * @returns { number } Returns the number of listener count. 450 * @syscap SystemCapability.Notification.Emitter 451 * @atomicservice 452 * @since 11 453 */ 454 /** 455 * Obtains the number of subscriptions to a specified event. 456 * 457 * @param { number | string } eventId - Event ID. The value of the string type cannot be an empty string. 458 * @returns { number } Returns the number of listener count. 459 * @syscap SystemCapability.Notification.Emitter 460 * @crossplatform 461 * @atomicservice 462 * @since arkts {'1.1':'12', '1.2':'20'} 463 * @arkts 1.1&1.2 464 */ 465 function getListenerCount(eventId: number | string): number; 466 467 /** 468 * Describes data passed in the event. 469 * 470 * @typedef EventData 471 * @syscap SystemCapability.Notification.Emitter 472 * @since 7 473 */ 474 /** 475 * Describes data passed in the event. 476 * 477 * @typedef EventData 478 * @syscap SystemCapability.Notification.Emitter 479 * @atomicservice 480 * @since 11 481 */ 482 /** 483 * Describes data passed in the event. 484 * 485 * @typedef EventData 486 * @syscap SystemCapability.Notification.Emitter 487 * @crossplatform 488 * @atomicservice 489 * @since arkts {'1.1':'12', '1.2':'20'} 490 * @arkts 1.1&1.2 491 */ 492 export interface EventData { 493 /** 494 * Data passed in the event. 495 * 496 * @type { ?object } 497 * @syscap SystemCapability.Notification.Emitter 498 * @since 7 499 */ 500 /** 501 * Data passed in the event. 502 * 503 * @type { ?object } 504 * @syscap SystemCapability.Notification.Emitter 505 * @atomicservice 506 * @since 11 507 */ 508 /** 509 * Data passed in the event. 510 * 511 * @type { ?object } 512 * @syscap SystemCapability.Notification.Emitter 513 * @crossplatform 514 * @atomicservice 515 * @since 12 516 */ 517 data?: { [key: string]: any }; 518 519 /** 520 * Data carried by the event. 521 * 522 * @type { ?Record<string, Object> } 523 * @syscap SystemCapability.Notification.Emitter 524 * @crossplatform 525 * @since 20 526 * @arkts 1.2 527 */ 528 data?: Record<string, Object>; 529 } 530 531 /** 532 * Describes an event to subscribe to or emit. The EventPriority settings do not take effect under event subscription. 533 * 534 * @typedef InnerEvent 535 * @syscap SystemCapability.Notification.Emitter 536 * @since 7 537 */ 538 /** 539 * Describes an event to subscribe to or emit. The EventPriority settings do not take effect under event subscription. 540 * 541 * @typedef InnerEvent 542 * @syscap SystemCapability.Notification.Emitter 543 * @atomicservice 544 * @since 11 545 */ 546 /** 547 * Describes an event to subscribe to or emit. The EventPriority settings do not take effect under event subscription. 548 * 549 * @typedef InnerEvent 550 * @syscap SystemCapability.Notification.Emitter 551 * @crossplatform 552 * @atomicservice 553 * @since arkts {'1.1':'12', '1.2':'20'} 554 * @arkts 1.1&1.2 555 */ 556 export interface InnerEvent { 557 /** 558 * Event ID. 559 * 560 * @type { number } 561 * @syscap SystemCapability.Notification.Emitter 562 * @since 7 563 */ 564 /** 565 * Event ID. 566 * 567 * @type { number } 568 * @syscap SystemCapability.Notification.Emitter 569 * @atomicservice 570 * @since 11 571 */ 572 /** 573 * Event ID. 574 * 575 * @type { number } 576 * @syscap SystemCapability.Notification.Emitter 577 * @crossplatform 578 * @atomicservice 579 * @since arkts {'1.1':'12', '1.2':'20'} 580 * @arkts 1.1&1.2 581 */ 582 eventId: number; 583 584 /** 585 * Event priority. The default value is EventPriority.LOW. 586 * 587 * @type { ?EventPriority } 588 * @syscap SystemCapability.Notification.Emitter 589 * @since 7 590 */ 591 /** 592 * Event priority. The default value is EventPriority.LOW. 593 * 594 * @type { ?EventPriority } 595 * @syscap SystemCapability.Notification.Emitter 596 * @atomicservice 597 * @since 11 598 */ 599 /** 600 * Event priority. The default value is EventPriority.LOW. 601 * 602 * @type { ?EventPriority } 603 * @syscap SystemCapability.Notification.Emitter 604 * @crossplatform 605 * @atomicservice 606 * @since arkts {'1.1':'12', '1.2':'20'} 607 * @arkts 1.1&1.2 608 */ 609 priority?: EventPriority; 610 } 611 612 /** 613 * Enumerates the event priorities. 614 * 615 * @enum { number } 616 * @syscap SystemCapability.Notification.Emitter 617 * @since 7 618 */ 619 /** 620 * Enumerates the event priorities. 621 * 622 * @enum { number } 623 * @syscap SystemCapability.Notification.Emitter 624 * @atomicservice 625 * @since 11 626 */ 627 /** 628 * Enumerates the event priorities. 629 * 630 * @enum { number } 631 * @syscap SystemCapability.Notification.Emitter 632 * @crossplatform 633 * @atomicservice 634 * @since arkts {'1.1':'12', '1.2':'20'} 635 * @arkts 1.1&1.2 636 */ 637 export enum EventPriority { 638 /** 639 * The event will be emitted immediately. 640 * 641 * @syscap SystemCapability.Notification.Emitter 642 * @since 7 643 */ 644 /** 645 * The event will be emitted immediately. 646 * 647 * @syscap SystemCapability.Notification.Emitter 648 * @atomicservice 649 * @since 11 650 */ 651 /** 652 * The event will be emitted immediately. 653 * 654 * @syscap SystemCapability.Notification.Emitter 655 * @crossplatform 656 * @atomicservice 657 * @since arkts {'1.1':'12', '1.2':'20'} 658 * @arkts 1.1&1.2 659 */ 660 IMMEDIATE = 0, 661 662 /** 663 * The event will be emitted before low-priority events. 664 * 665 * @syscap SystemCapability.Notification.Emitter 666 * @since 7 667 */ 668 /** 669 * The event will be emitted before low-priority events. 670 * 671 * @syscap SystemCapability.Notification.Emitter 672 * @atomicservice 673 * @since 11 674 */ 675 /** 676 * The event will be emitted before low-priority events. 677 * 678 * @syscap SystemCapability.Notification.Emitter 679 * @crossplatform 680 * @atomicservice 681 * @since arkts {'1.1':'12', '1.2':'20'} 682 * @arkts 1.1&1.2 683 */ 684 HIGH, 685 686 /** 687 * The event will be emitted before idle-priority events. By default, an event is in LOW priority. 688 * 689 * @syscap SystemCapability.Notification.Emitter 690 * @since 7 691 */ 692 /** 693 * The event will be emitted before idle-priority events. By default, an event is in LOW priority. 694 * 695 * @syscap SystemCapability.Notification.Emitter 696 * @atomicservice 697 * @since 11 698 */ 699 /** 700 * The event will be emitted before idle-priority events. By default, an event is in LOW priority. 701 * 702 * @syscap SystemCapability.Notification.Emitter 703 * @crossplatform 704 * @atomicservice 705 * @since arkts {'1.1':'12', '1.2':'20'} 706 * @arkts 1.1&1.2 707 */ 708 LOW, 709 710 /** 711 * The event will be emitted after all the other events. 712 * 713 * @syscap SystemCapability.Notification.Emitter 714 * @since 7 715 */ 716 /** 717 * The event will be emitted after all the other events. 718 * 719 * @syscap SystemCapability.Notification.Emitter 720 * @atomicservice 721 * @since 11 722 */ 723 /** 724 * The event will be emitted after all the other events. 725 * 726 * @syscap SystemCapability.Notification.Emitter 727 * @crossplatform 728 * @atomicservice 729 * @since arkts {'1.1':'12', '1.2':'20'} 730 * @arkts 1.1&1.2 731 */ 732 IDLE, 733 } 734 735 /** 736 * Describes the event emit priority. 737 * 738 * @typedef Options 739 * @syscap SystemCapability.Notification.Emitter 740 * @since 11 741 */ 742 /** 743 * Describes the event emit priority. 744 * 745 * @typedef Options 746 * @syscap SystemCapability.Notification.Emitter 747 * @crossplatform 748 * @atomicservice 749 * @since arkts {'1.1':'12', '1.2':'20'} 750 * @arkts 1.1&1.2 751 */ 752 export interface Options { 753 /** 754 * Event priority. The default value is EventPriority.LOW. 755 * 756 * @type { ?EventPriority } 757 * @syscap SystemCapability.Notification.Emitter 758 * @atomicservice 759 * @since 11 760 */ 761 /** 762 * Event priority. The default value is EventPriority.LOW. 763 * 764 * @type { ?EventPriority } 765 * @syscap SystemCapability.Notification.Emitter 766 * @crossplatform 767 * @atomicservice 768 * @since arkts {'1.1':'12', '1.2':'20'} 769 * @arkts 1.1&1.2 770 */ 771 priority?: EventPriority; 772 } 773 774 /** 775 * Describes the generic data passed in the event. 776 * 777 * @typedef GenericEventData<T> 778 * @syscap SystemCapability.Notification.Emitter 779 * @crossplatform 780 * @atomicservice 781 * @since arkts {'1.1':'12', '1.2':'20'} 782 * @arkts 1.1&1.2 783 */ 784 export interface GenericEventData<T> { 785 /** 786 * Data passed in the event. T: generic type. 787 * 788 * @type { ?T } 789 * @syscap SystemCapability.Notification.Emitter 790 * @crossplatform 791 * @atomicservice 792 * @since arkts {'1.1':'12', '1.2':'20'} 793 * @arkts 1.1&1.2 794 */ 795 data?: T; 796 } 797} 798 799export default emitter; 800