One more tweak for ember-data; fix parens.

This commit is contained in:
Chris Krycho 2017-12-19 16:18:58 -07:00
parent 572137414c
commit 93bf0e8fc2
No known key found for this signature in database
GPG Key ID: FA77559C18FE8A08
3 changed files with 10 additions and 10 deletions

View File

@ -424,7 +424,7 @@ declare module "ember-data" {
* Create a JSON representation of the record, using the serialization
* strategy of the store's adapter.
*/
serialize(options?: {}): {};
serialize(options?: { includeId?: boolean }): {};
/**
* Use [DS.JSONSerializer](DS.JSONSerializer.html) to
* get the JSON representation of a record.

View File

@ -8,7 +8,7 @@ const Person = DS.Model.extend({
title: DS.attr({ defaultValue: "The default" }),
title2: DS.attr({ defaultValue: () => "The default" }),
fullName: Ember.computed('firstName', 'lastName', function () {
fullName: Ember.computed('firstName', 'lastName', function() {
return `${this.get('firstName')} ${this.get('lastName')}`;
})
});

View File

@ -18,7 +18,7 @@ post.save().then((saved) => {
assertType<Post>(saved);
});
store.findRecord<Post>('post', 1).then(function (post) {
store.findRecord<Post>('post', 1).then(function(post) {
post.get('title'); // => "Rails is Omakase"
post.set('title', 'A new post');
post.save(); // => PATCH to '/posts/1'
@ -28,13 +28,13 @@ class User extends DS.Model {
username = DS.attr('string');
}
store.queryRecord<User>('user', {}).then(function (user) {
store.queryRecord<User>('user', {}).then(function(user) {
let username = user.get('username');
console.log(`Currently logged in as ${username}`);
});
store.findAll('blog-post'); // => GET /blog-posts
store.findAll('author', { reload: true }).then(function (authors) {
store.findAll('author', { reload: true }).then(function(authors) {
authors.getEach('id'); // ['first', 'second']
});
store.findAll('post', {
@ -56,14 +56,14 @@ class Message extends DS.Model {
}
const messages = store.peekAll<Message>('message');
messages.forEach(function (message) {
messages.forEach(function(message) {
message.set('hasBeenSeen', true);
});
messages.save();
const people = store.peekAll('person');
people.get('isUpdating'); // false
people.update().then(function () {
people.update().then(function() {
people.get('isUpdating'); // false
});
people.get('isUpdating'); // true
@ -79,16 +79,16 @@ const tom = store.query('user', {
filter: {
email: 'tomster@example.com'
}
}).then(function (users) {
}).then(function(users) {
return users.get("firstObject");
});
// GET /users?isAdmin=true
const admins = store.query('user', { isAdmin: true });
admins.then(function () {
admins.then(function() {
console.log(admins.get("length")); // 42
});
admins.update().then(function () {
admins.update().then(function() {
admins.get('isUpdating'); // false
console.log(admins.get("length")); // 123
});