Руководство по API командной строки

Sam Bulatov
Sep 22, 2018 · 7 min read

$_

$0 — $4

$(selector, [startNode])

$$(selector, [startNode])

var images = $$('img');for (each in images) {
console.log(images[each].src);
}
var images = $$(
'img',
document.querySelector('.devsite-header-background')
);
for (each in images) {
console.log(images[each].src);
}

$x(path, [startNode])

$x("//p")
$x("//p[a]")

clear()

clear();

copy(object)

copy($0);

debug(function)

debug(getData);

dir(object)

document.body;
dir(document.body);

dirxml(object)

inspect(object/function)

inspect(document.body);

getEventListeners(object)

getEventListeners(document);

keys(object)

var player1 = {
"name": "Ted",
"level": 42
}

monitor(function)

function sum(x, y) {
return x + y;
}
monitor(sum);

monitorEvents(object[, events])

monitorEvents(window, "resize");
monitorEvents(window, ["resize", "scroll"])
monitorEvents($0, "key");

profile([name]) и profileEnd([name])

profile("My profile")
profileEnd("My profile")
profile('A');
profile('B');
profileEnd('A');
profileEnd('B');

table(data[, columns])

var names = {
0: { firstName: "John", lastName: "Smith" },
1: { firstName: "Jane", lastName: "Doe" }
};
table(names);

undebug(function)

undebug(getData);

unmonitor(function)

unmonitor(getData);

unmonitorEvents(object[, events])

unmonitorEvents(window);
monitorEvents($0, "mouse");
unmonitorEvents($0, "mousemove");

values(object)

values(object);

Sam Bulatov

Written by

Front-end Developer, Speaker, Roller

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade