Skip to content

Instantly share code, notes, and snippets.

@rupton
Created May 7, 2013 21:31
Show Gist options
  • Save rupton/5536315 to your computer and use it in GitHub Desktop.
Save rupton/5536315 to your computer and use it in GitHub Desktop.
//PUBLISHER
var j$ = jQuery.noConflict();
Sfdc.canvas(function(){
alert("Page loaded, libraries ready");
console.log("Page loaded, libraries ready");
//set up message publisher event handler
j$("#btnSend").click(function(){
var message = j$("#msgbox").val();
var sr = JSON.parse('<%= jsonRequest%>');
Sfdc.canvas.client.publish(sr.client,
{name: "jrupreorg.message", payload: {message:message}});
});
});
// SUBSCRIBER
j$("#mSubscribe").click(function(){
alert("subscribed")
Sfdc.canvas.client.subscribe(sr.client,
{name : "jrupreorg.message", onData : function (event) {
j$("#rMsgBox").append("<li>"+event.message+"</li>");
}});
});
//unsubscribe event handler
j$("#mUnSubscribe").click(function(){
alert("unsubscribed");
Sfdc.canvas.client.unsubscribe(sr.client,{name: "jrupreorg.message"});
});
@CodisRedding
Copy link

I <3 u jhersh

@deckblad
Copy link

deckblad commented May 8, 2013

Guys, I wish I were drunk right now.

@CodisRedding
Copy link

I'm drunk in love with jhersh deckblad

@jhersh
Copy link

jhersh commented May 8, 2013

what is this I don't even

@CodisRedding
Copy link

don't play dumb, silly man... you know what love is.

@jhersh
Copy link

jhersh commented May 8, 2013

But I need more minerals!

@CodisRedding
Copy link

I'd let you erect my pylon any day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment