Introducing the new micro JavaScript SDK

Today we introduce a new SDK: the micro JavaScript SDK. This framework is intented to be used while developing hosted web apps in Backbeam. The normal SDK is discouraged to be used in these applications because many of its funcionality depends on the API keys and the API keys should not be visible to anyone. The micro JavaScript SDK only implements funcionality that does not depend on the API keys. That's what "micro" stands for.

In order to use the micro JavaScript SDK you just need to add a script tag since Backbeam serves it automatically for you:

<script src="/backbeam-micro.js"></script>

Additionally you don't need to configure it, the SDK is already fully configured. It has zero dependencies and doesn't conflict with other JavaScript libraries

With this SDK you can request objects from controllers. Supposing you have a controller like this:

// this controller responds to queries made to GET /objects
backbeam.select('place').fetch(100, 0, response)

You can request that controller easily:

backbeam.requestObjects('GET', '/objects', {}, function(err, objects, total) {
    for (var i=0; i<objects.length; i++) {
        console.log('name =', objects[i].get('name'))
    }
})

You can also request JSON from controllers. For example

// this controller responds to queries made to GET /json
response.json({ hello: 'world' })

And then you can request the JSON easily from your web browser:

backbeam.requestJSON('GET', '/json', {}, function(err, data) {
    console.log('data =', data)
})

You can also use the realtime API like in the full JavaScript SDK. For example:

backbeam.subscribeToRealTimeConnectionEvents({
    connect: function() {
        backbeam.sendRealTimeEvent('my-event-name', {data:'thedata'})
    }
})
backbeam.subscribeToRealTimeEvents('my-event-name', function(eventName, data) {
    console.log('received', data)
})
backbeam.enableRealTime() // enable the realtime API

And that's all. No more, no less. You can now start doing sophisticated frontend development with Backbeam in no time.