ember-sortable
Version:
Sortable UI primitives for Ember.
38 lines (34 loc) • 1.02 kB
TypeScript
/**
Drags elements by an offset specified in pixels.
Examples
drag(
'mouse',
'.some-list li[data-item=uno]',
function() {
return { dy: 50, dx: 20 };
}
);
@method drag
@param {'mouse'|'touch'} [mode]
event mode
@param {String} [itemSelector]
selector for the element to drag
@param {Function} [offsetFn]
function returning the offset by which to drag
@param {Object} [callbacks]
callbacks that are fired at the different stages of the interaction
@return {Promise}
*/
export type TMode = 'mouse' | 'touch';
interface Callbacks {
dragstart?: () => Promise<void>;
dragmove?: () => Promise<void>;
beforedragend?: () => Promise<void>;
dragend?: () => Promise<void>;
}
export declare function drag(mode: TMode, itemSelector: keyof (HTMLElementTagNameMap | SVGElementTagNameMap) | string, // or Parameters<typeof find>[0][]
offsetFn: () => {
dx: number;
dy: number;
}, callbacks?: Callbacks): Promise<void>;
export {};