signalpoint / jDrupal

A JavaScript Library and API for Drupal Applications
http://jdrupal.tylerfrankenstein.com/
GNU General Public License v2.0
76 stars 38 forks source link
drupal javascript mobile-app web-app

What is jDrupal?

A simple Vanilla JavaScript Library and API.

What is jDrupal used for?

Drupal 8 Application Development.

What kind of apps?

A variety of application architectures, including...

jDrupal...

Since jDrupal has no dependencies and is written in pure JavaScript, it can be used in a wide variety of architectures and frameworks. Just include it in the <head> of your app's index.html file:

<html>
  <head>
    <!-- ... -->
    <script src="https://github.com/signalpoint/jDrupal/raw/8.x-1.x/jdrupal.min.js"></script>
    <!-- ... -->
  </head>
  <body><!-- ... --></body>
</html>

Quick Examples

// Connect to Drupal and say hello to the current user.
jDrupal.connect().then(function() {
  var user = jDrupal.currentUser();
  var msg = user.isAuthenticated() ?
    'Hello ' + user.getAccountName() : 'Hello World';
  alert(msg);
});
// Load a node and display the title.
jDrupal.nodeLoad(123).then(function(node) {
  alert(node.getTitle());
});
// Login and show the user their id.
jDrupal.userLogin('bob', 'secret').then(function() {
  alert(jDrupal.currentUser().id());
});
// Get results from a view and print the node ids to the console.
jDrupal.viewsLoad('my-view-url').then(function(view) {
  var results = view.getResults();
  for (var i = 0; i < results.length; i ++) {
    var node = new jDrupal.Node(results[i]);
    console.log('node id: ' + node.id());
  }
});

Getting Started

jDrupal is best friends with DrupalGap, the open source application development kit for Drupal websites.

Cordova + iOS

If you're developing an iOS app using cordova, follow these additional instructions.