Thought I might be able to kill 2 birds with one stone when I implement the appData backend if I could implement the shindig.Container.prototype.userPrefStore as an appData passthrough. Append a prefix to the appId so the persistent data can be differentiated (between real appData and userpref data for the same appId).

If you'll forgive the (lack of) accuracy of the js... has anyone tried anything like this?

shindig.AppDataBasedUserPrefStore.prototype.getPrefs = function (gadget) {
    return osapi.appdata.get({
          appId: "UP_" + gadget.id,
          userId: "@me",
          fields: "@all" });
};

shindig.AppDataBasedUserPrefStore.prototype.savePrefs = function (gadget) {
    osapi.appdata.update({
          appId: "UP_" + gadget.id,
          userId: "@me",
          data: gadget.UserPrefs });
};

shindig.AppDataBasedUserPrefStore = function() {
  gadgets.UserPrefStore.call(this);
};

shindig.AppDataBasedUserPrefStore.inherits(shindig.UserPrefStore);

shindig.Container.prototype.userPrefStore = new shindig.AppDataBasedUserPrefStore();

Reply via email to