forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
onsenui.d.ts
1017 lines (972 loc) · 39.6 KB
/
onsenui.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Type definitions for Onsen UI
// Project: http://onsen.io
// Definitions by: Fran Dios <https://github.com/frankdiox/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Some useful types
interface stringArray {
[index: number]: string;
}
interface objectArray {
[index: number]: any;
}
/**
* @description Should be used as root component of each page. The content inside page component is scrollable
*/
interface PageView {
/**
* @return {Object} Device back button handler
* @description Get the associated back button handler. This method may return null if no handler is assigned
*/
getDeviceBackButtonHandler(): any;
}
/**
* @description Carousel component
*/
interface CarouselView {
/**
* @description Show next ons-carousel item
*/
next(): void;
/**
* @description Show previous ons-carousel item
*/
prev(): void;
/**
* @description Show first ons-carousel item
*/
first(): void;
/**
* @description Show last ons-carousel item
*/
last(): void;
/**
* @param {Booelan} swipeable If value is true the carousel will be swipeable
* @description Set whether the carousel is swipeable or not
*/
setSwipeable(swipeable: boolean): void;
/**
* @return {Boolean} true if the carousel is swipeable
* @description Returns whether the carousel is swipeable or not
*/
isSwipeable(): boolean;
/**
* @param {Number} index The index that the carousel should be set to
* @description Specify the index of the ons-carousel-item to show
*/
setActiveCarouselItemIndex(index: number): void;
/**
* @return {Number} The current carousel item index
* @description Returns the index of the currently visible ons-carousel-item
*/
getActiveCarouselItemIndex(): number;
/**
* @param {Boolean} enabled If true auto scroll will be enabled
* @description Enable or disable "auto-scroll" attribute
*/
setAutoScrollEnabled(enabled: boolean): void;
/**
* @return {Boolean} true if auto scroll is enabled
* @description Returns whether the "auto-scroll" attribute is set or not
*/
isAutoScrollEnabled(): boolean;
/**
* @param {Number} ratio The desired ratio
* @description Set the auto scroll ratio. Must be a value between 0.0 and 1.0
*/
setAutoScrollRatio(ratio: number): void;
/**
* @return {Number} The current auto scroll ratio
* @description Returns the current auto scroll ratio
*/
getAutoScrollRatio(): number;
/**
* @param {Boolean} overscrollable If true the carousel will be overscrollable
* @description Set whether the carousel is overscrollable or not
*/
setOverscrollable(overscrollable: boolean): void;
/**
* @return {Boolean} Whether the carousel is overscrollable or not
* @description Returns whether the carousel is overscrollable or not
*/
isOverscrollable(): boolean;
/**
* @description Update the layout of the carousel. Used when adding ons-carousel-items dynamically or to automatically adjust the size
*/
refresh(): void;
/**
* @return {Boolean} Whether the carousel is disabled or not
* @description Returns whether the dialog is disabled or enabled
*/
isDisabled(): boolean;
/**
* @param {Boolean} disabled If true the carousel will be disabled
* @description Disable or enable the dialog
*/
setDisabled(disabled: boolean): void;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
/**
* @description Component that adds "pull-to-refresh" to an <ons-page> element
*/
interface PullHookView {
/**
* @param {Boolean} disabled If true the pull hook will be disabled
* @description Disable or enable the component
*/
setDisabled(disabled: boolean): void;
/**
* @return {Boolean} true if the pull hook is disabled
* @description Returns whether the component is disabled or enabled
*/
isDisabled(): boolean;
/**
* @param {Number} height Desired height
* @description Specify the height
*/
setHeight(height: number): void;
/**
* @param {Number} thresholdHeight Desired threshold height
* @description Specify the threshold height
*/
setThresholdHeight(thresholdHeight: number): void;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
/**
* @description Divides the screen into a left and right section
*/
interface SplitView {
/**
* @param {String} pageUrl Page URL. Can be either an HTML document or an <ons-template>
* @description Show the page specified in pageUrl in the right section
*/
setMainPage(pageUrl: string): void;
/**
* @param {String} pageUrl Page URL. Can be either an HTML document or an <ons-template>
* @description Show the page specified in pageUrl in the left section
*/
setSecondaryPage(pageUrl: string): void;
/**
* @description Trigger an 'update' event and try to determine if the split behaviour should be changed
*/
update(): void;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
interface dialogOptions {
animation?: string;
callback?: any;
}
/**
* @modifier android Display an Android style alert dialog
* @description Alert dialog that is displayed on top of the current screen
*/
interface AlertDialogView {
/**
* @param {Object} [options] Parameter object
* @param {String} [options.animation] Animation name. Available animations are "fade", "slide" and "none"
* @param {Function} [options.callback] Function to execute after the dialog has been revealed
* @description Show the alert dialog
*/
show(options?: dialogOptions): void;
/**
* @param {Object} [options] Parameter object
* @param {String} [options.animation] Animation name. Available animations are "fade", "slide" and "none"
* @param {Function} [options.callback] Function to execute after the dialog has been hidden
* @description Hide the alert dialog
*/
hide(options?: dialogOptions): void;
/**
* @description Returns whether the dialog is visible or not
* @return {Boolean} true if the dialog is currently visible
*/
isShown(): boolean;
/**
* @description Destroy the alert dialog and remove it from the DOM tree
*/
destroy(): void;
/**
* @description Define whether the dialog can be canceled by the user or not
* @param {Boolean} cancelable If true the dialog will be cancelable
*/
setCancelable(cancelable: boolean): void;
/**
* @description Returns whether the dialog is cancelable or not
* @return {Boolean} true if the dialog is cancelable
*/
isCancelable(): boolean;
/**
* @description Disable or enable the alert dialog
* @param {Boolean} disabled If true the dialog will be disabled
*/
setDisabled(disabled: boolean): void;
/**
* @description Returns whether the dialog is disabled or enabled
* @return {Boolean} true if the dialog is disabled
*/
isDisabled(): boolean;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
/**
* @description Dialog that is displayed on top of current screen
*/
interface DialogView {
/**
* @param {Object} [options] Parameter object
* @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide"
* @param {Function} [options.callback] This function is called after the dialog has been revealed
* @description Show the dialog
*/
show(options?: dialogOptions): void;
/**
* @param {Object} [options] Parameter object
* @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide"
* @param {Function} [options.callback] This functions is called after the dialog has been hidden
* @description Hide the dialog
*/
hide(options?: dialogOptions): void;
/**
* @description Returns whether the dialog is visible or not
* @return {Boolean} true if the dialog is visible
*/
isShown(): boolean;
/**
* @description Destroy the dialog and remove it from the DOM tree
*/
destroy(): void;
/**
* @return {Object} Device back button handler
* @description Retrieve the back button handler for overriding the default behavior
*/
getDeviceBackButtonHandler(): any;
/**
* @param {Boolean} cancelable If true the dialog will be cancelable
* @description Define whether the dialog can be canceled by the user or not
*/
setCancelable(cancelable: boolean): void;
/**
* @description Returns whether the dialog is cancelable or not
* @return {Boolean} true if the dialog is cancelable
*/
isCancelable(): boolean;
/**
* @description Disable or enable the dialog
* @param {Boolean} disabled If true the dialog will be disabled
*/
setDisabled(disabled: boolean): void;
/**
* @description Returns whether the dialog is disabled or enabled
* @return {Boolean} true if the dialog is disabled
*/
isDisabled(): boolean;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
/**
* @modifier outline Button with outline and transparent background
* @modifier light Button that doesn't stand out
* @modifier quiet Button with no outline and or background
* @modifier cta Button that really stands out
* @modifier large Large button that covers the width of the screen
* @modifier large--quiet Large quiet button
* @modifier large--cta Large call to action button
* @description Button component. If you want to place a button in a toolbar, use ons-toolbar-button or ons-back-button instead
*/
interface ButtonView {
/**
* @description Show spinner on the button
*/
startSpin(): void;
/**
* @description Remove spinner from button
*/
stopSpin(): void;
/**
* @return {Boolean} true if the button is spinning
* @description Return whether the spinner is visible or not
*/
isSpinning(): boolean;
/**
* @description Set spin animation. Possible values are "slide-left" (default), "slide-right", "slide-up", "slide-down", "expand-left", "expand-right", "expand-up", "expand-down", "zoom-out", "zoom-in"
* @param {String} animation Animation name
*/
setSpinAnimation(animation: string): void;
/**
* @description Disable or enable the button
*/
setDisabled(disabled: boolean): void;
/**
* @return {Boolean} true if the button is disabled
* @description Returns whether the button is disabled or enabled
*/
isDisabled(): boolean;
}
/**
* @description Switch component
*/
interface SwitchView {
/**
* @return {Boolean} true if the switch is on
* @description Returns true if the switch is ON
*/
isChecked(): boolean;
/**
* @param {Boolean} checked If true the switch will be set to on
* @description Set the value of the switch. isChecked can be either true or false
*/
setChecked(checked: boolean): void;
/**
* @return {HTMLElement} The underlying checkbox element
* @description Get inner input[type=checkbox] element
*/
getCheckboxElement(): HTMLElement;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
/**
* @description
* Modal component that masks current screen
* Underlying components are not subject to any events while the modal component is shown
*/
interface ModalView {
/**
* @description Toggle modal visibility
*/
toggle(): void;
/**
* @description Show modal
*/
show(): void;
/**
* @description Hide modal
*/
hide(): void;
/**
* @return {Object} Device back button handler
* @description Retrieve the back button handler
*/
getDeviceBackButtonHandler(): any;
}
interface navigatorOptions {
animation?: string;
onTransitionEnd?: any;
}
/**
* @description A component that provides page stack management and navigation. This component does not have a visible content
*/
interface NavigatorView {
/**
* @param {String} pageUrl Page URL. Can be either a HTML document or a <code><ons-template></code>
* @param {Object} [options] Parameter object
* @param {String} [options.animation] Animation name. Available animations are "slide", "simpleslide", "lift", "fade" and "none"
* @param {Function} [options.onTransitionEnd] Function that is called when the transition has ended
* @description Pushes the specified pageUrl into the page stack
*/
pushPage(pageUrl: string, options?: navigatorOptions): void;
/**
* @param {Number} index The index where it should be inserted
* @param {String} pageUrl Page URL. Can be either a HTML document or a <code><ons-template></code>
* @param {Object} [options] Parameter object
* @param {String} [options.animation] Animation name. Available animations are "slide", "simpleslide", "lift", "fade" and "none"
* @description Insert the specified pageUrl into the page stack with specified index
*/
insertPage(index: number, pageUrl: string, options?: navigatorOptions): void;
/**
* @param {Object} [options] Parameter object
* @param {Function} [options.onTransitionEnd] Function that is called when the transition has ended
* @description Pops the current page from the page stack. The previous page will be displayed
*/
popPage(options?: navigatorOptions): void;
/**
* @param {String} pageUrl Page URL. Can be either a HTML document or an <code><ons-template></code>
* @param {Object} [options] Parameter object
* @param {String} [options.animation] Animation name. Available animations are "slide", "simpleslide", "lift", "fade" and "none"
* @param {Function} [options.onTransitionEnd] Function that is called when the transition has ended
* @description Clears page stack and adds the specified pageUrl to the page stack
*/
resetToPage(pageUrl: string, options?: navigatorOptions): void;
/**
* @return {Object} Current page object
* @description Get current page's navigator item. Use this method to access options passed by pushPage() or resetToPage() method
*/
getCurrentPage(): any;
/**
* @return {List} List of page objects
* @description Retrieve the entire page stack of the navigator
*/
getPages(): objectArray;
/**
* @return {Object} Device back button handler
* @description Retrieve the back button handler for overriding the default behavior
*/
getDeviceBackButtonHandler(): any;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
interface slidingMenuOptions {
closeMenu?: boolean;
callback?: any;
}
/**
* @description Component for sliding UI where one page is overlayed over another page. The above page can be slided aside to reveal the page behind
*/
interface SlidingMenuView {
/**
* @param {String} pageUrl Page URL. Can be either an HTML document or an <code><ons-template></code>
* @param {Object} [options] Parameter object
* @param {Boolean} [options.closeMenu] If true the menu will be closed
* @param {Function} [options.callback] Function that is executed after the page has been set
* @description Show the page specified in pageUrl in the main contents pane
*/
setMainPage(pageUrl: string, options?: slidingMenuOptions): void;
/**
* @param {String} pageUrl Page URL. Can be either an HTML document or an <code><ons-template></code>
* @param {Object} [options] Parameter object
* @param {Boolean} [options.closeMenu] If true the menu will be closed after the menu page has been set
* @param {Function} [options.callback] This function will be executed after the menu page has been set
* @description Show the page specified in pageUrl in the side menu pane
*/
setMenuPage(pageUrl: string, options?: slidingMenuOptions): void;
/**
* @param {Object} [options] Parameter object
* @param {Function} [options.callback] This function will be called after the menu has been opened
* @description Slide the above layer to reveal the layer behind
*/
openMenu(options?: slidingMenuOptions): void;
/**
* @param {Object} [options] Parameter object
* @param {Function} [options.callback] This function will be called after the menu has been closed
* @description Slide the above layer to hide the layer behind
*/
closeMenu(options?: slidingMenuOptions): void;
/**
* @param {Object} [options] Parameter object
* @param {Function} [options.callback] This function will be called after the menu has been opened or closed
* @description Slide the above layer to reveal the layer behind if it is currently hidden, otherwise, hide the layer behind
*/
toggleMenu(options?: slidingMenuOptions): void;
/**
* @return {Boolean} true if the menu is currently open
* @description Returns true if the menu page is open, otherwise false
*/
isMenuOpened(): boolean;
/**
* @return {Object} Device back button handler
* @description Retrieve the back-button handler
*/
getDeviceBackButtonHandler(): any;
/**
* @param {Boolean} swipeable If true the menu will be swipeable
* @description Specify if the menu should be swipeable or not
*/
setSwipeable(swipeable: boolean): void;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
interface tabbarOptions {
keepPage?: boolean;
}
/**
* @description A component to display a tab bar on the bottom of a page. Used with ons-tab to manage pages using tabs
*/
interface TabbarView {
/**
* @param {Number} index Tab index
* @param {Object} [options] Parameter object
* @param {Boolean} [options.keepPage] If true the page will not be changed
* @param {String} [options.animation] Animation name. Available animations are "fade" and "none"
* @return {Boolean} true if the change was successful
* @description Show specified tab page. Animations and other options can be specified by the second parameter
*/
setActiveTab(index: number, options?: tabbarOptions): boolean;
/**
* @return {Number} The index of the currently active tab
* @description Returns tab index on current active tab. If active tab is not found, returns -1
*/
getActiveTab(): number;
/**
* @param {String} url Page URL. Can be either an HTML document or an <code><ons-template></code>
* @description Displays a new page without changing the active index
*/
loadPage(url: string): void;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
interface popoverOptions {
animation?: string;
}
/**
* @modifier android Display an Android style popover
* @description A component that displays a popover next to an element
*/
interface PopoverView {
/**
* @param {String|Event|HTMLElement} target Target element. Can be either a CSS selector, an event object or a DOM element
* @param {Object} [options] Parameter object
* @param {String} [options.animation] Animation name. Available animations are "fade" and "none"
* @description Open the popover and point it at a target. The target can be either an event, a css selector or a DOM element
*/
show(target: any, options?: popoverOptions): void;
/**
* @param {Object} [options] Parameter object
* @param {String} [options.animation] Animation name. Available animations are "fade" and "none"
* @description Close the popover
*/
hide(options?: popoverOptions): void;
/**
* @return {Boolean} true if the popover is visible
* @description Returns whether the popover is visible or not
*/
isShown(): boolean;
/**
* @description Destroy the popover and remove it from the DOM tree
*/
destroy(): void;
/**
* @param {Boolean} cancelable If true the popover will be cancelable
* @description Set whether the popover can be canceled by the user when it is shown
*/
setCancelable(cancelable: boolean): void;
/**
* @return {Boolean} true if the popover is cancelable
* @description Returns whether the popover is cancelable or not
*/
isCancelable(): boolean;
/**
* @param {Boolean} disabled If true the popover will be disabled
* @description Disable or enable the popover
*/
setDisabled(disabled: boolean): void;
/**
* @return {Boolean} true if the popover is disabled
* @description Returns whether the popover is disabled or enabled
*/
isDisabled(): boolean;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
//# Onsen Objects
/**
* @description A global object that's used in Onsen UI. This object can be reached from the AngularJS scope
*/
interface onsStatic {
/**
* @description Method used to wait for app initialization. The callback will not be executed until Onsen UI has been completely initialized
* @param {Function} callback Function that executes after Onsen UI has been initialized
*/
ready(callback: any): void;
/**
* @description Initialize Onsen UI. Can be used to load Onsen UI without using the <code>ng-app</code> attribute from AngularJS
* @param {String} [moduleName] AngularJS module name
* @param {Array} [dependencies] List of AngularJS module dependencies
* @return {Object} An AngularJS module object
*/
bootstrap(moduleName?: string, dependencies?: objectArray): any;
/**
* @description Enable status bar fill feature on iOS7 and above
*/
enableAutoStatusBarFill(): void;
/**
* @description Disable status bar fill feature on iOS7 and above
*/
disableAutoStatusBarFill(): void;
/**
* @param {String} name Name of component, i.e. 'ons-page'
* @param {Object|jqLite|HTMLElement} [dom] $event, jqLite or HTMLElement object
* @return {Object} Component object. Will return null if no component was found
* @description Find parent component object of <code>dom</code> element
*/
findParentComponentUntil(name: string, dom?: any): any;
/**
* @param {String} selector CSS selector
* @param {HTMLElement} [dom] DOM element to search from
* @return {Object} Component object. Will return null if no component was found
* @description Find component object using CSS selector
*/
findComponent(selector: string, dom?: HTMLElement): any;
/**
* @param {Function} listener Function that executes when device back button is pressed
* @description Set default handler for device back button
*/
setDefaultDeviceBackButtonListener(listener: (eventObject: any) => any): void;
/**
* @description Disable device back button event handler
*/
disableDeviceBackButtonHandler(): void;
/**
* @description Enable device back button event handler
*/
enableDeviceBackButtonHandler(): void;
/**
* @return {Boolean} Will be true if Onsen UI is initialized
* @description Returns true if Onsen UI is initialized
*/
isReady(): boolean;
/**
* @param {HTMLElement} dom Element to compile
* @description Compile Onsen UI components
*/
compile(dom: HTMLElement): void;
/**
* @return {Boolean} Will be true if the app is running in Cordova
* @description Returns true if running inside Cordova
*/
isWebView(): boolean;
/**
* @param {String} page Page name. Can be either an HTML file or an <ons-template> containing a <ons-alert-dialog> component
* @param {Object} [options] Parameter object
* @param {Object} [options.parentScope] Parent scope of the dialog. Used to bind models and access scope methods from the dialog
* @return {Promise} Promise object that resolves to the alert dialog component object
* @description Create a alert dialog instance from a template
*/
createAlertDialog(page: string): any;
/**
* @param {String} page Page name. Can be either an HTML file or an <ons-template> containing a <ons-dialog> component
* @param {Object} [options] Parameter object
* @param {Object} [options.parentScope] Parent scope of the dialog. Used to bind models and access scope methods from the dialog
* @return {Promise} Promise object that resolves to the dialog component object
* @description Create a dialog instance from a template
*/
createDialog(page: string): any;
/**
* @param {String} page Page name. Can be either an HTML file or an <ons-template> containing a <ons-dialog> component
* @param {Object} [options] Parameter object
* @param {Object} [options.parentScope] Parent scope of the dialog. Used to bind models and access scope methods from the dialog
* @return {Promise} Promise object that resolves to the popover component object
* @description Create a popover instance from a template
*/
createPopover(page: string): any;
/**
* @description Utility methods to create different kinds of alert dialogs. There are three methods available: alert, confirm and prompt
*/
notification: onsNotification;
/**
* @description Utility methods for orientation detection
*/
orientation: onsOrientation;
/**
* @description Utility methods to detect current platform
*/
platform: onsPlatform;
}
interface alertOptions {
message?: string;
messageHTML?: string;
buttonLabel?: string;
buttonLabels?: stringArray;
primaryButtonIndex?: number;
cancelable?: boolean;
animation?: string;
title?: string;
modifier?: string;
callback?: any;
}
interface onsNotification {
/**
* @param {Object} options Parameter object
* @param {String} [options.message] Alert message
* @param {String} [options.messageHTML] Alert message in HTML
* @param {String} [options.buttonLabel] Label for confirmation button. Default is "OK"
* @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide"
* @param {String} [options.title] Dialog title. Default is "Alert"
* @param {String} [options.modifier] Modifier for the dialog
* @param {Function} [options.callback] Function that executes after dialog has been closed
* @description
* Display an alert dialog to show the user a message
* The content of the message can be either simple text or HTML
* Must specify either message or messageHTML
*/
alert(options: alertOptions): void;
/**
* @param {Object} options Parameter object
* @param {String} [options.message] Confirmation question
* @param {String} [options.messageHTML] Dialog content in HTML
* @param {Array} [options.buttonLabels] Labels for the buttons. Default is ["Cancel", "OK"]
* @param {Number} [options.primaryButtonIndex] Index of primary button. Default is 1
* @param {Boolean} [options.cancelable] Whether the dialog is cancelable or not. Default is false
* @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide"
* @param {String} [options.title] Dialog title. Default is "Confirm"
* @param {String} [options.modifier] Modifier for the dialog
* @param {Function} [options.callback]
* Function that executes after the dialog has been closed
* Argument for the function is the index of the button that was pressed or -1 if the dialog was canceled
* @description
* Display a dialog to ask the user for confirmation
* The default button labels are "Cancel" and "OK" but they can be customized
* Must specify either message or messageHTML
*/
confirm(options: alertOptions): void;
/**
* @param {Object} options Parameter object
* @param {String} [options.message] Prompt question
* @param {String} [options.messageHTML] Dialog content in HTML
* @param {String} [options.buttonLabel] Label for confirmation button. Default is "OK"
* @param {Number} [options.primaryButtonIndex] Index of primary button. Default is 1
* @param {Boolean} [options.cancelable] Whether the dialog is cancelable or not. Default is false
* @param {String} [options.animation] Animation name. Available animations are "none", "fade" and "slide"
* @param {String} [options.title] Dialog title. Default is "Alert"
* @param {String} [options.modifier] Modifier for the dialog
* @param {Function} [options.callback]
* Function that executes after the dialog has been closed
* Argument for the function is the value of the input field or null if the dialog was canceled
* @description
* Display a dialog with a prompt to ask the user a question
* Must specify either message or messageHTML
*/
prompt(options: alertOptions): void;
}
interface onsOrientation {
/**
* @return {Boolean} Will be true if the current orientation is portrait mode
* @description Returns whether the current screen orientation is portrait or not
*/
isPortrait(): boolean;
/**
* @return {Boolean} Will be true if the current orientation is landscape mode
* @description Returns whether the current screen orientation is landscape or not
*/
isLandscape(): boolean;
/**
* @description Add an event listener
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
on(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Add an event listener that's only triggered once
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
once(eventName: string, listener: (eventObject: any) => any): void;
/**
* @description Remove an event listener. If the listener is not specified all listeners for the event type will be removed
* @param {String} eventName Name of the event
* @param {Function} listener Function to execute when the event is triggered
*/
off(eventName: string, listener?: (eventObject: any) => any): void;
}
interface onsPlatform {
/**
* @description Returns whether app is running in Cordova
* @return {Boolean}
*/
isWebView(): boolean;
/**
* @description Returns whether the OS is iOS
* @return {Boolean}
*/
isIOS(): boolean;
/**
* @description Returns whether the OS is Android
* @return {Boolean}
*/
isAndroid(): boolean;
/**
* @description Returns whether the device is iPhone
* @return {Boolean}
*/
isIPhone(): boolean;
/**
* @description Returns whether the device is iPad
* @return {Boolean}
*/
isIPad(): boolean;
/**
* @description Returns whether the device is BlackBerry
* @return {Boolean}
*/
isBlackBerry(): boolean;
/**
* @description Returns whether the browser is Opera
* @return {Boolean}
*/
isOpera(): boolean;
/**
* @description Returns whether the browser is Firefox
* @return {Boolean}
*/
isFirefox(): boolean;
/**
* @description Returns whether the browser is Safari
* @return {Boolean}
*/
isSafari(): boolean;
/**
* @description Returns whether the browser is Chrome
* @return {Boolean}