我有一些从网络服务器获取的对象。对象的某些属性需要额外的异步解析,但出于性能原因我想延迟执行此操作。我试图使用代理来拦截访问,然后在访问时解析属性。我的处理程序看起来像这样
class MyClass {
type() {
return "my new class";
}
}
let myObject = new MyClass();
let proxy = new Proxy(myObject, {
get: async(target, prop, receiver) => {
if (prop === "attribute") {
let newProp = prop + "_parsed";
if (!(newProp in target)) {
return await (new Promise((resolve, reject) => { resolve("parsed value") }));
}
else {
return target[newProp];
}
}
else {
return Reflect.get(target, prop, receiver);
}
},
});
console.log(proxy.attribute); // "parsed value"
console.log(proxy.type()); // "my new class" …Run Code Online (Sandbox Code Playgroud)我一直在谷歌搜索和搜索这是杀了我.我只是想设置我们的RoR服务器,以便能够查询谷歌游戏购买API,以验证订阅是否已更新,我似乎无法找到实际的解决方案.我已经浏览了所有的谷歌文档.看来我需要一个如此处所述的服务帐户
https://developers.google.com/accounts/docs/OAuth2ServiceAccount
但后来我发现这篇关于他们实际上希望我们如何使用Web服务器应用程序流的python文章
http://milancermak.wordpress.com/2012/08/24/server-side-verification-of-google-play-subsc/
我现在并不在意,我只需要让服务器成功地与Google API通信以验证/续订订阅.我找到了0条关于这个流如何工作的文章.有没有人得到这个工作?