Instantly share code, notes, and snippets.

@mignev /live-queries.html Secret
Last active Sep 18, 2016

What would you like to do?
Live Queries setup
<!doctype html>
<meta charset="utf-8">
<title>SashiDo Live Queries Example!</title>
<meta name="description" content="My Parse App">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script type="text/javascript" src=""></script>
<style type="text/css">
body {padding: 20px;}
<div class="row">
<div class="col-sm-12">
<h1>Live Query Result:</h1>
<pre id="json">Waiting for changes ...</pre></div>
<script type="text/javascript">
* Your credentials from:
* SashiDo Dashboard > You app > App Settings > Security & Keys
var server_url = '',
app_id = 'xxxxxx',
javascript_key = 'xxxxx',
classname = '_User';
Parse.initialize(app_id, javascript_key);
Parse.serverURL = server_url;
var ClassObject = Parse.Object.extend(classname);
var query = new Parse.Query(ClassObject);
var subscription = query.subscribe();
subscription.on('create', function(obj)
console.log('create', obj.attributes);
subscription.on('update', function(obj)
console.log('update', obj.attributes);
document.getElementById("json").innerHTML = JSON.stringify(obj.attributes, undefined, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment