The JavaScript blog.


APIs storage indexeddb

Query IndexedDB Like MongoDB

Posted on .

Kent Safranski sent in Indexed, a library that wraps around IndexedDB with a friendly MongoDB-inspired API.

You can insert objects like this:

  name: 'John Doe'
  email: 'jdoe@email.com'
}, function(err, data) {
  if (err) {
  } else {

And fetch them again with find:

  _id: 28972387982
}, function(err, data) {

You can even use MongoDB-style operators:

  someNumber: { $gt : 25 }
}, function(err, data) {

You'll probably like this if you work with databases in Node. It's actually part of a larger project called Riggr, a framework based around RequireJS, Knockout and jQuery. Although I think indexed.js is cool enough that it should be a separate module, rather than being bundled in with Riggr.

Kent wrote a detailed blog post about indexed.js here: Indexed: Query IndexedDB Like Mongo.


jquery backbone.js indexeddb jquery-ui

jQuery Roundup: jQuery UI 1.9.1, IndexedDB on Cordova, Backbone.ViewKit

Posted on .

Note: You can send your plugins and articles in for review through our contact form or @dailyjs.

jQuery UI 1.9.1

jQuery UI 1.9.1 was released a few days ago. This is a maintenance release that includes bug fixes for many widgets and the core library. The jQuery UI 1.9.1 Changelog has full details of the fixes.

Bootstrap 2.2.0

Bootstrap 2.2.0 templates

Bootstrap 2.2.0 is out. This version includes much needed additional templates, a media component, a new variable-driven typographic scale, and other more minor tweaks.

IndexedDB on Cordova

Parashuram Narasimhan has got his IndexedDB polyfill working on on Cordova. This means it can be used with iOS and Android applications:

Parashuram's posts include details on the techniques he uses to get IndexedDB working on each platform. For example, with Android he currently has to use JavaScript to inject the polyfill during the deviceready event.


Backbone.ViewKit (License: MIT) by Scott Nelson is a Backbone.js plugin for managing views with transitions in an iOS-inspired fashion. It adds Backbone.ViewKit.ViewPort which renders sets of views, displaying one at a time. Stacks of views are managed using Backbone.ViewKit.ViewStack, which allows views to be pushed or popped as required.

Transition animations can be triggered using Backbone.ViewKit.Transition:

new Backbone.ViewKit.Transitions.Slide({  
   reverse: false
 , duration: 0.4
 , easing: 'ease-out'
 , delay: 0

There's a demo here: Backbone.ViewKit demo.


jquery plugins databases backbone.js indexeddb bootstrap

jQuery Roundup: Bootstrap Extensions, IndexedDB Polyfill, Backbone UI

Posted on .

Note: You can send your plugins and articles in for review through our contact form or @dailyjs.

Nijiko's Bootstrap Extensions

Nijiko Yonskai sent us two new Bootstrap extensions: Notifications (GitHub: Nijikokun / bootstrap-notify, License: Apache 2.0) and Toggle Switches (GitHub: Nijikokun / bootstrap-toggle, License: Apache 2.0).

The Notifications extension uses the same look and feel as Bootstrap's built-in alerts, but displays them as popups instead. It works like a typical jQuery plugin:

  message: { text: 'Here is a simple message' },
  type: 'success'
}).show(); // for the ones that aren't closable and don't fade out there is a .close() function.

The Toggle Switches extension turns checkboxes into a larger more graphical switch that looks a bit like the iOS UISwitch. The author has included the required CSS as well.

IndexedDB Polyfill

The current state of client-side databases is confusing, mainly because there are major browsers that still don't support IndexedDB. However, the IndexedDB Polyfill (GitHub: axemclion / IndexedDBShim, License: GPL2/BSD) by Parashuram Narasimhan allows browsers that still support Web SQL Database to use Indexed Database API instead. It also works with the author's JQuery IndexedDB Plugin.

Including this polyfill on a page allows applications to use window.indexedDB as a single point into the IndexedDB API. The author has written some additional material about the plugin on his blog:

Backbone UI

Backbone UI (GitHub: perka / backbone-ui, License: MIT) by Joe Stelmach allows Backbone models and collections to be displayed as UI components. By using data binding, the UI is kept up-to-date, and it's pretty easy to change the components using CSS.

The authors have attempted to make it work more closely with the DOM rather than using HTML templates. This is possible in part due to Joe's Laconic library. The focus is on JavaScript-heavy client-side applications rather than traditional server-side generated templates.

The documentation includes a sample to-do list application, and the source is surprisingly easy to follow and concise.


hosting node browser database iOS indexeddb

Gazel, Heroku Node Versions, nios

Posted on .


Gazel (GitHub: matthewp / gazel, License: MPL 2.0) by Matthew Phillips is a key-value store for browsers, based on Redis. The API is similar to Redis, and has a friendly chainable syntax:

var client = gazel.createClient();

client.on('error', function(err) {  
  console.error('Error:', err);

  .set('key', 1)
  .incrby('key', 10)
  .exec(function(results) {
    var key = results.pop()[0];

It uses IndexedDB for storage, and will attempt to use vendor-specific versions where available. The author has written a sizeable suite of Mocha tests that can be run in a browser.

Heroku Node Version Support

Heroku now permit Node and npm versions to be requested using your application's package.json file:

  "name": "myapp",
  "version": "0.0.1",
  "engines": {
    "node": "0.6.x",
    "npm":  "1.0.x"

The available versions are listed here:

Heroku defaults to their oldest version of Node 0.4, so it's probably a good idea to specify the latest 0.6 version.

Read more here: Specifying a version of Node.js / npm


Node iOS

nios by Sebastian Waisbrot is a Node port for iOS. The objective is to allow Node projects to run on an iOS device with minimal modifications. It uses WebViewJavascriptBridge to run Node's libraries.

The example that comes with the project runs a Node HTTP server within a native iOS app.


libraries ui databases browser indexeddb

reMarked.js, Scroll.js, Andro.js, IndexedDB Examples

Posted on .


reMarked.js (GitHub: leeoniya / reMarked.js, License: MIT) by Leon Sorokin converts a client-side DOM fragment into Markdown. The reMarked.js homepage has several links to GitHub READMEs on the left-hand side, and pressing the 'reMark it!' button will convert their HTML into Markdown.

The author's ultimate goal is to use this in a WYSIWYG editor. It seems like a difficult project, so it features tests as well.


Scroll.js (License: MIT) by David Babaioff is a cross-browser library for managing the scroll event:

Scroll.bind('scroll_1', function() {  
    // Your event handler code goes here.
    'scroll_2': function() {
        // Your event handler code goes here.
    'scroll_3': function() {
        // Your event handler code goes here.

It doesn't have any dependencies, so it may be useful in cases where you don't want to use a larger library like jQuery.


Andro.js (GitHub: maryrosecook / androjs, License: MIT) by Mary Rose Cook combines the idea of reusable behaviour with events:

Behaviour mixins are good for writing video games. They help with the concoction of game object logic: no more nightmarish inheritance hierarchies or weird bundles of functions that invent cryptic interfaces for the objects upon which they operate.

The author's example is a cube that gets augmented with behaviours to provide logic based around events:

var Andro = require('andro').Andro  
  , andro = new Andro()
  , soundBehaviour
  , cube;

function Cube() {  
  this.touch = function(contact) {
    andro.eventer(this).emit('touch', contact);

soundBehaviour = {  
  setup: function(owner, eventer) {
    eventer.bind(this, 'touch', function() {
      console.log('SFX: Leo_the_Lion.wav');

cube = new Cube();  
andro.augment(cube, firstTouchBehaviour);  

Here I've paraphrased the original example at androjs.maryrosecook.com/ just to give an idea of the syntax. I agree with the author that this library provides some useful tools for representing game logic, and the documentation also provides examples of situations where this might not work so well.

IndexedDB Examples

These IndexedDB examples by Parashuram Narasimhan show what works in Chrome, Firefox, and Internet Explorer 8+. The standards are still changing, but Parashuram has been working hard to track the current state of API changes in both his blog and the jquery-indexeddb plugin.

For more on IndexedDB, see the usual suspects: W3C: Indexed Database API, MDN: IndexedDB.