Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add JS Doc for Local Datastore #558

Merged
merged 6 commits into from
Feb 14, 2019
Merged

Conversation

dplewis
Copy link
Member

@dplewis dplewis commented Oct 4, 2018

Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good. one grammar nit and some feedback


## Pinning with Labels

Manually pinning and unpinning each object individual is a bit like using `malloc` and `free`. It is a very powerful tool, but it can be difficult to manage what objects get stored in complex scenarios. For example, imagine you are making a game with separate high score lists for global high scores and your friends' high scores. If one of your friends happens to have a globally high score, you need to make sure you don't unpin them completely when you remove them from one of the cached queries. To make these scenarios easier, you can also pin with a label. Labels indicate a group of objects that should be stored together.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. individual should be individually
  2. the example of 'malloc' and 'free' should be removed. only a very very small percentage of readers will even know what that is anymore ;). its not adding value here either.
  3. I don't follow your example. Can you try to re-write it to make the issue more clear (again, I'm not sure what the issue you're trying to point out is)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made the changes and added another section

await Parse.Object.unPinAllObjectsWithName('MyScores');
```

Any object will stay in the datastore as long as it is pinned with any label. In other words, if you pin an object with two different labels, and then unpin it with one label, the object will stay in the datastore until you also unpin it with the other label.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than Any object, just Objects

here's a take at re-writing:

An Object will be kept in the datastore as long as it is pinned by at least one label. So an object pinned with two labels will stay in the datastore if one of the two labels is unpinned.

@flovilmart flovilmart removed their request for review February 13, 2019 19:50
Copy link
Contributor

@acinader acinader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

await anotherGameScore.pinWithName('MyScores');
```

To unpin all of the objects with the same label at the same time, you can pass a label to the unpin methods. This saves you from having to manually track which objects are in each group you care about.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove 'you care about'

@dplewis dplewis changed the title [Draft] Add JS Doc for Local Datastore Add JS Doc for Local Datastore Feb 14, 2019
@dplewis dplewis merged commit 5e9f3fd into parse-community:gh-pages Feb 14, 2019
@dplewis dplewis deleted the lds branch February 14, 2019 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants