Skip to content

Instantly share code, notes, and snippets.

@Raynos

Raynos/x.js Secret

Last active December 11, 2015 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Raynos/477c8b821ea450c713c7 to your computer and use it in GitHub Desktop.
Save Raynos/477c8b821ea450c713c7 to your computer and use it in GitHub Desktop.
/*
append is widget aware and knows how to either append DOMElement's to a container
or append a widget to a container
`var widget = append(container, MyWidget(...))`
*/
function append(container, widget) {
var elem = widget.view ? widget.view : widget
container.appendChild(elem)
return widget
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment