Everything You Need to Know



If you know how to use jQuery, you know how to use ChocolateChip-UI's DOM engine. We built it to replicate the functionality of jQuery.

$(function() {
  $('#element').css('color', 'red').addClass('important');
  $('li').on('tap', function(e) {
    $(this).append('... some text')

Deferred Objects

ChocolateChip-UI does not implement jQuery's Deferred object. Instead it uses ES6 promises. If you are targeting an older version of Android, such as Kitkat (4.4) or earlier, you'll need to use polyfills for promises


ChocolateChip-UI does not implement jQuery's Ajax. Instead you can use fetch, which is a modern replacement for remote server access. If you are targeting Android 4.4 or earlier (Kitkat), you can use the fetch polyfill. If you aren't going to use any of fetch's more exotic features, you can get by with a barebones polyfill. If you prefer the Ajax interface of jQuery, you can use Axios

Local Data Persistence

ChocolateChip-UI version 4 introduced $.Box for local data persistence. This was a huge chunk of code that had to support using indexedDB, WebSQL or localStorage. It was also a lot of work to maintain. We bit off more than we could chew. This version of ChocolateChip is refocused on what it does well – making apps. ChocolateChip-UI version 5 does not have any built in data persistence. If you want local data persistence for you app you do have several options. You can use localforage. This has a very similar API to $.Box and more features. You might also like to use PouchDB, local data persistence that automatically sychs up with a remove CouchDB and compatible servers. Another option is the popular Firebase data solution from Google. This also provides solutions for offline data.

For more information about specific DOM methods, check out the API documentation.