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
| 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 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
| //for content type "Comment" | |
| Everlive.Events.beforeUpdate((request, context, done) => { | |
| //do some validation | |
| done(); | |
| }); | |
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" | |
| Everlive.CloudFunction.onRequest((request, response, done) => { | |
| var filter = new Everlive.Query(); | |
| filter.where().eq('title', request.queryString.title); | |
| Everlive.Sdk.fromContext() | |
| .data('Movies') |
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
| everlive.push.notifications.create({ | |
| Filter: { | |
| 'Parameters.City': 'Tokyo' | |
| }, | |
| Message: '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
| var query = new Everlive.Query(); | |
| query.expand({ | |
| Post: { | |
| TargetTypeName : 'Post' | |
| } | |
| }); |
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 = everlive.data('GameScore'); | |
| //Create | |
| gameScore.create({ score : 1337 }).then(...); | |
| //Read | |
| gameScore.getById('item-id').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
| async search(substring) { | |
| const url = `${SEARCH_URL}${encodeURIComponent(substring)}`; | |
| const response = await fetch(url); | |
| const $ = cheerio.load(await response.text()); | |
| const videoElements = $(VIDEO_CLASS); | |
| const getIdSelector = id => `${VIDEO_CLASS}[data-context-item-id=${id}]`; | |
| return Array.from(videoElements).map((videoEl) => { | |
| const id = videoEl.attribs['data-context-item-id']; | |
| const idSelector = getIdSelector(id); |