SparkJS not working in browser

I’m having issues trying to get the SparkJS to work in browser. The documentation says it will work in a browser, but I cannot do much of anything.

First of all, the documentation (http://docs.spark.io/javascript/#installation-client-side) seems to include commands that are available on 0.2.2 but includes the script that includes 0.2.0 which does not have many of the commands listed available. That should probably be updated.

Second, spark.login() with an token seems to work, but when I try to subscribe to an event I get nothing. I’ve included a screen shot of what I’m seeing in Firebug.

Sorry that no one picked this up yet. I’m not familiar with SparkJS at all but is this related?

@solojavier might be able to answer this.

From what I see, onEvent is not being called with correct params:

You could try:

spark.onEvent('test', function(data) {
    console.log("Event: " + data);
});

or:

spark.on('test', function(err, body) {
    console.log('API call completed on test event:', test);
});
3 Likes

@solojavier In the screen shot I provided I’m using the same code as in your first example, it’s just all on one line (which shouldn’t be causing any issues). I’ve included another screen shot to make this clearer.

Hi @drukz,

Hmm… I think this might be my fault. I think I didn’t update the minified build during the last release. I just released a new version 0.2.3, with the updated minified build. Can you grab that and try again? Sorry about that!

Thanks!
David

1 Like