Oh, one last point. So the reason I recommend making a separate file for
mycontainer.js and using inherits is because it makes upgrading the version
of your container infinitely easier. The reference files always get upgraded
to support the latest version of opensocial (0.7 right now) and are set up
in such a way that you can simply drop in the new files when you want to
upgrade your site. This allows you to perhaps implement one or two more
mycontainer methods for each version without worrying about exactly what the
user facing calls are. That's the only reason why just putting code between
the {} isn't recommended. (it would work though :)

- Cassie


On Wed, Feb 6, 2008 at 8:26 PM, Cassie <[EMAIL PROTECTED]> wrote:

> I think Kevin might have confused your question with another one Akash.
>
> Here is what you should do:
>  1. Use the opensocial reference files found in the
> features/opensocial-reference directory (you did this already)
>  2. Create one additional file called "mycontainer.js"
>  3. Within mycontainer.js make a javascript class which extends the
> opensocial.container class found in the container.js file. You can use the
> .inherits method to do this extension. (Function.inherits is included in
> opensocial.js)
>  4. Override/implement all of the methods you need to. The functions
> should have some semi-decent js docs which tell you what you need to do.
>  5. As the last line in your mycontainer.js file call
> opensocial.Container.set(new MyContainer()); (tailor that to your class of
> course)
>
> And that's it! That should give you a fully functioning opensocial
> container. The code you just created all goes within each of the gadget
> iframes (that's just the default setup we have right now, it is not
> mandatory) and then gadgets can use the opensocial calls.
>
>
> Now, steps 3-5 are a little tricky to describe with words which is why I
> made the samplecontainer.js file. You can find it in your
> features/opensocial-samplecontainer directory. It does the inherits, has
> some fake data, implements the right things and so forth. Many people may
> want to just copy the samplecontainer.js file and modify it to suit their
> needs. The one main difference is that your opensocial container will
> probably need to talk back to your servers (rather than just having all of
> the data locally).
>
> I am working on a servercontainer.js which will hopefully serve as a good,
> and more useful, reference container. It will most likely talk back to some
> optional shindig servlets or something. I haven't made to much progress yet
> though so if you get yours working and want to submit a patch that would be
> fantastic!
>
> Okay, let me know if you have any troubles and happy opensocialing it up.
>
> - Cassie
>
>
>
> On Sun, Feb 3, 2008 at 5:12 PM, Akash Xavier <[EMAIL PROTECTED]>
> wrote:
>
> > Kevin,
> >
> > Do I just have to fill those blanks between { }  or do I have to edit
> > the
> > function names?
> >
> > On Feb 3, 2008 1:53 PM, Kevin Brown <[EMAIL PROTECTED]> wrote:
> >
> > > I wouldn't try to use the sample pages to make real sites. As the name
> > > "reference" implies, they really are just there to show you how to
> > wire
> > > your
> > > own site to use the server. Hopefully this will become clearer once
> > the
> > > RpcServlet becomes available and it's possible to really do everything
> > the
> > > "right way".
> > >
> > > ~Kevin
> > >
> > > On Feb 3, 2008 9:39 AM, Akash Xavier <[EMAIL PROTECTED]> wrote:
> > >
> > > > Hi everyone,
> > > >
> > > > I just downloaded the .js files of opensocial from the Google
> > OpenSocial
> > > > Specs page...
> > > > Someone on the IRC Opensocial channel told me that those JS files
> > are
> > > just
> > > > like templates and that developers are responsible to wire them up.
> > Are
> > > we
> > > > supposed to just fill those gaps between empty {} ?
> > > >
> > > > --
> > > > Akash Manohar
> > > > [EMAIL PROTECTED]
> > > >
> > >
> >
> >
> >
> > --
> > Akash Manohar
> > [EMAIL PROTECTED]
> >
>
>

Reply via email to