This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var PrivateUserData = el.data('PrivateUserData'); | |
| el.Data('SomeContentType').findId('item-id') | |
| .then(res => { | |
| //find item id from PrivateUserData | |
| return everlive.users.currentUser() | |
| .then(user => PrivateUserData.setOwner(user.Id, res.result.Id)); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var GameScore = Parse.Object.extend('GameScore'); | |
| var gameScore = new GameScore(); | |
| gameScore.set('score', 1337); | |
| //Create | |
| gameScore.save().then(...); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Post = Parse.Object.extend('Post'); | |
| var myComment = new Comment(); | |
| myComment.set('content', 'Let\'s do Sushirrito.'); | |
| myComment.set('post', new Post()); | |
| myComment.save(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Parse.Push.send({ | |
| channels: [ 'Tokyo' ], | |
| data: { | |
| alert: 'The Giants won against the Mets 2-3.' | |
| } | |
| }).then(...); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //cloud function named "findMovie" | |
| Parse.Cloud.define('findMovie', (request, response) => { | |
| const query = new Parse.Query('Movies'); | |
| query.equalTo('title', request.params.title); | |
| query.first() | |
| .then(movie => response.success(movie)) | |
| .catch(err => response.error(err)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //for class/collection "Comment" | |
| Parse.Cloud.beforeSave('Comment', (request, response) => { | |
| //do some validation | |
| response.success(); | |
| }); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var query = new Parse.Query('Game'); | |
| var subscription = query.subscribe(); | |
| //more events are - open, update, enter, leave, delete, close | |
| subscription.on('create', (object) => { | |
| console.log('object created'); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var privateData = Parse.Object.extend('PrivateUserData'); | |
| privateData.setACL(new Parse.ACL(Parse.User.current())); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var express = require('express'); | |
| var cowsay = require('cowsay'); | |
| //initialize express.js instance | |
| var app = express(); | |
| //this creates a GET endpoint for your application |