Javascript Chrome Extention get caret coordinates

I just started with a new chrome extension however I couldn’t find how to get the exact caret (text cursor) position in JavaScript

code

chrome.commands.onCommand.addListener(function (command) {
    console.log('Command:', command);
    if (command == "OpenRightclick-menu") {
        // Get coordinates
    }
});