Skip to content
Mark Nadal edited this page Sep 16, 2018 · 1 revision

If you are unfamiliar with chaining, it is an API style that allows you to zoom into a context without having to create new variables. So rather than doing...

// ugly
var page = document.getElementById("page");
var child = page.firstElementChild;
child.style.background = "blue";
child.style.color = "green";
child.addEventListener('click', function(event){
  console.log("hello world!");
}, true);

...you can just do

$('#page')
	.children()
	.first()
	.css("background", "blue")
	.css("color", "green")
	.on("click", function(event){
		console.log("hello world");
	});

As you can tell, it was popularized by jQuery.

Next up?

This wiki is where all the GUN website documentation comes from.

You can read it here or on the website, but the website has some special features like rendering some markdown extensions to create interactive coding tutorials.

Please feel free to improve the docs itself, we need contributions!

Clone this wiki locally