For brevity, all the examples use a closure.
A Bunch of Common jDrupal Examples
Understanding Closures
With a closure, you can access jDrupal using a $
:
// With a closure...
(function($) {
$.nodeLoad(123).then(function(node) {
console.log(node.getTitle());
});
})(jDrupal);
Without a closure, you can access jDrupal using the jDrupal
object:
// Without a closure...
jDrupal.nodeLoad(123).then(function(node) {
console.log(node.getTitle());
});
Using jQuery too?
Then don't use a $
for your jDrupal closure.