@foreverrbum/ethsign
Version:
This package will allow you to electronically sign documents within your application
36 lines (28 loc) • 886 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useFocusOnEle = void 0;
var _react = _interopRequireDefault(require("react"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* @pzhu
* @description for some dom action
*
*/
/**
*
* @param {string} id dom id
* @param {boolean} canBeFocus condition for focus
*/
var useFocusOnEle = function useFocusOnEle(id) {
var canBeFocus = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
(0, _utils.useMount)(function () {
if (canBeFocus) {
var _document$getElementB;
(_document$getElementB = document.getElementById(id)) === null || _document$getElementB === void 0 ? void 0 : _document$getElementB.focus();
}
});
};
exports.useFocusOnEle = useFocusOnEle;