mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-08-26 11:12:19 +08:00
Add definitions and tests for muted callbacks
This commit is contained in:
@@ -421,6 +421,26 @@ picker.get('id');
|
||||
picker.get('enable');
|
||||
picker.get('disable');
|
||||
|
||||
// Set multiple at once
|
||||
picker.set({
|
||||
select: new Date(2015, 3, 20),
|
||||
highlight: [2015, 3, 20],
|
||||
min: -4
|
||||
});
|
||||
|
||||
// Muted callbacks
|
||||
|
||||
// One at a time
|
||||
picker.set('disable', 'flip', { muted: true })
|
||||
|
||||
// Multiple at once
|
||||
picker.set({
|
||||
select: [1988, 7, 14],
|
||||
view: new Date(1988, 7, 14),
|
||||
max: 4
|
||||
}, { muted: true });
|
||||
|
||||
// Clear the value in the picker’s input element.
|
||||
picker.set('clear');
|
||||
|
||||
// Set select for a date item object
|
||||
|
||||
+10
-2
@@ -255,6 +255,14 @@ declare module Pickadate {
|
||||
interval?: number;
|
||||
}
|
||||
|
||||
interface SetOptions {
|
||||
/**
|
||||
* By default, any callbacks bound with the on method will be fired when its relevant thing is set.
|
||||
* To silently set a thing, pass an options object with the muted parameter set to true.
|
||||
*/
|
||||
muted: boolean;
|
||||
}
|
||||
|
||||
interface Picker<TPickerObject, TItemObject extends Item, TOptions extends SetObject> {
|
||||
/** The picker's relative input element wrapped as a jQuery object. */
|
||||
$node: JQuery;
|
||||
@@ -322,8 +330,8 @@ declare module Pickadate {
|
||||
get(thing: string, format: string): string;
|
||||
|
||||
/** Set the properties, objects, and states to change the state of the picker. */
|
||||
set(thing: string, value?: any, options?: any): TPickerObject;
|
||||
set(things: TOptions, options?: any): TPickerObject;
|
||||
set(thing: string, value?: any, options?: SetOptions): TPickerObject;
|
||||
set(things: TOptions, options?: SetOptions): TPickerObject;
|
||||
|
||||
/** Bind callbacks to get fired off when the relative picker method is called. */
|
||||
on(methodName: string, callback: (data?: any) => void): TPickerObject;
|
||||
|
||||
Reference in New Issue
Block a user