/*! * Copyright 2017 - 2020 by ChartIQ, Inc. * All rights reserved. */ import { StandardErrorCallback, StandardPromise } from "../types"; /** * Adds a local hotkey, firing only when the window calling the method is in focus. If you execute this function more than once for the same key combination, both hotkeys will coexist, and would need to be remove separately. * This function uses browser key capture, so it will work when assimilation is not running. * * This is exported because it is called by LinkerButton until that can be rewritten to use HTML5 events * * ```javascript * var myFunction = function () {...} * FSBL.Clients.HotkeyClient.addBrowserHotkey(["ctrl","shift","s"],myFunction) * ``` * @param {Array} [keyArr] Array of strings representing hotkey key combination. * @param {function} [handler] Function to be executed when the hotkey combination is pressed. It is recommended that you define a variable to represent the handler function, as the same function must be passed in order to remove the hotkey. * @param {boolean} [addedByUser] Indicates that Hotkey was added as Local Hotkey by user. * @internal * @private * @ignore */ export declare const addBrowserHotkey: (keyArr: string[], handler: () => void, addedByUser?: boolean) => void; /** * This method is deprecated. Use HTML5 key events when a window is in focus. * * Adds a local hotkey which fires only when the window calling the method is in focus. If you execute this function more than once for the same key combination, both hotkeys will coexist, and would need to be removed separately. * * ```javascript * var myFunction = function () {...} * FSBL.Clients.HotkeyClient.addLocalHotkey(["ctrl", "shift", "s"], myFunction, cb) * ``` * @param {Array.} keyArr Array of strings representing hotkey key combination. * @param {function} handler Function to be executed when the hotkey combination is pressed. It is recommended that you define a variable to represent the handler function, as the same function must be passed in order to remove the hotkey. * @param {StandardCallback} cb Callback to be called after local hotkey is added. * @deprecated */ export declare const addLocalHotkey: (keyArr: string[], handler: (...args: any[]) => void, cb?: StandardErrorCallback) => StandardPromise; /** * This method is deprecated. Use HTML5 key events when a window is in focus. * * Removes a local hotkey. * * ```javascript * FSBL.Clients.HotkeyClient.removeLocalHotkey(["ctrl", "shift", "s"], myFunction, cb) * ``` * @param {Array.} keyArr Array of strings representing hotkey key combination. * @param {function} handler Handler registered for the hotkey to be removed. * @param {StandardCallback} cb Callback to be called after local hotkey is removed. * @deprecated */ export declare const removeLocalHotkey: (keyArr: string[], handler: (...args: any[]) => void, cb?: StandardErrorCallback) => StandardPromise; /** * Adds a global hotkey which fires regardless of what window is in focus. If you execute this function more than once for the same key combination, both hotkeys will coexist, and would need to be removed separately. * * ```javascript * var myFunction = function () {...} * FSBL.Clients.HotkeyClient.addGlobalHotkey(["ctrl", "shift", "s"], myFunction, cb) * ``` * @param {Array.} keyArr Array of strings representing a hotkey key combination. * @param {function} handler Function to be executed when the hotkey combination is pressed. It is recommended that you define a variable to represent the handler function, as the same function must be passed in order to remove the hotkey. * @param {StandardCallback} cb Callback to be called after local hotkey is added. */ export declare const addGlobalHotkey: (keyArr: string[], handler: Function | any, cb?: StandardErrorCallback) => StandardPromise; /** * Removes a global hotkey. * * ```javascript * FSBL.Clients.HotkeyClient.removeGlobalHotkey(["ctrl", "shift", "s"], myFunction, cb) * ``` * @param {Array.} keyArr Array of strings representing hotkey key combination. * @param {function} handler Handler registered for the hotkey to be removed. * @param {StandardCallback} cb Callback to be called after local hotkey is removed. */ export declare const removeGlobalHotkey: (keyArr: string[], handler: Function | any, cb?: StandardErrorCallback) => StandardPromise; /** * Unregister all hotkeys, both locally and service-side. * @param {StandardCallback} cb Optional callback function */ export declare const removeAllHotkeys: (cb?: StandardErrorCallback) => StandardPromise; /** * Automatically unregister all hotkeys when the window containing the client closes * @ignore */ export declare const onClose: (cb?: () => void) => void; /** * @ignore */ export declare const HotkeyClient: { /** * For backward compatibility * @private * @deprecated */ initialize: () => void; /** * For backward compatibility * @private * @deprecated */ onReady: (cb?: any) => void; onClose: (cb?: () => void) => void; addGlobalHotkey: (keyArr: string[], handler: Function | any, cb?: StandardErrorCallback) => StandardPromise; removeAllHotkeys: (cb?: StandardErrorCallback) => StandardPromise; removeGlobalHotkey: (keyArr: string[], handler: Function | any, cb?: StandardErrorCallback) => StandardPromise; addLocalHotkey: (keyArr: string[], handler: (...args: any[]) => void, cb?: StandardErrorCallback) => StandardPromise; removeLocalHotkey: (keyArr: string[], handler: (...args: any[]) => void, cb?: StandardErrorCallback) => StandardPromise; addBrowserHotkey: (keyArr: string[], handler: () => void, addedByUser?: boolean) => void; }; /** * @ignore */ export default HotkeyClient; //# sourceMappingURL=hotkeyClient.d.ts.map