Parse.com JS API を使用しています。parse.userメソッドを使用する場合
getCurrentUser: function getCurrentUser(callback)
{
var currentUser = Parse.User.current();
callback(currentUser);
}
それは私の背中を与えるでしょう:
このオブジェクトの属性に本当に興味があるので、次のようにする必要があります。
getCurrentUser: function getCurrentUser(callback)
{
var currentUser = Parse.User.current();
//Not quite sure why I need to do that but I fugre out I cannot not really get the user object without
var userObject = new Object();
userObject.nick = currentUser.attributes.nick;
userObject.gender = currentUser.attributes.gender;
userObject.favoriteGenre = currentUser.favoriteGenre;
callback(userObject);
}
それを行う少し汚い方法はどれですか?
この障害を克服するためのより良い方法はありますか?
メソッド Parse.User.current(); を使用していることに注意してください。parse.com への呼び出しを保存して、ローカル ストレージから情報を取得できます。
前もって感謝します!
編集:
私も使用できるのを見ました:
Parse.User.current().get("nick");
どちらがきれいに思えますが、場合によっては parse.com 呼び出しを必要以上に消費するのではないかと考えさせられます。誰かがそれについて知っていますか?