I copied some code:
document.addEventListener('DOMContentLoaded', function()
{
var checkPageButton = document.getElementById('checkPage');
checkPageButton.addEventListener('click', function()
{
chrome.tabs.getSelected(null, function(tab)
Of, course, this looks terrible, because it indents all the way to the bracket. Is there anyway to get it like 2 spaces:
document.addEventListener('DOMContentLoaded', function()
{
var checkPageButton = document.getElementById('checkPage');
checkPageButton.addEventListener('click', function()
{
chrome.tabs.getSelected(null, function(tab)
I don't know if there is a way to do this in javascript-mode
, but I just tested Web Mode , and it has this behavior by default. This was the indentation it gave me for your code ( emacs -Q
):
document.addEventListener('DOMContentLoaded', function()
{
var checkPageButton = document.getElementById('checkPage');
checkPageButton.addEventListener('click', function()
{
chrome.tabs.getSelected(null, function(tab)
I use web-mode
both for standalone JS files, and for HTML files with embedded JS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.