Mike November

Phonetic alphabet for my initials, k?

Just a couple of things

Posted by Marcus Nyeholt on 16 August 2011 | 0 Comments

Tags: ,

A couple of new things - I've added a new SilverStripe module for defining APIs a little bit more specifically than dealing with the rest service that comes out of the box. Instead of being an XML/JSON wrapper around data objects, it's an XML/JSON wrapper around service classes (business logic) to allow you to be specific about what end users get. It's also meant to encourage re-usable service layer code, that can be used from your controller layer too.

WebServices module

I've also been playing around with Porthole for doing cross-frame-domain javascript communication (more on that project another time). It's a little barebones for what I need it for, so I wrote a wrapper around it to enable some more structured communication. This allows for registering a handler class (with methods) to handle the incoming communication, and for sending communication to specific methods of bound handlers.

// this call must be made, as it sets up the appropriate data comms 
// to the child frame
ProxyFrameManager.listenTo('FrameName');

// to send to the child
ProxyFrameManager.send('FrameName', 'methodName', 'param1', {and: 'so on'});

Then in the child...

ProxyFrameManager.listenTo('$ParentPageProxyUrl', {
    methodName: function (param, objectParam) {
    // do something to handle the call here
    }
});

Proxy Frame Manager

A demo can be found here

Comments

No one has commented on this page yet.

Post your comment

RSS feed for comments on this page | RSS feed for all comments