Created
May 7, 2013 21:31
-
-
Save rupton/5536315 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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"}); | |
}); |
Guys, I wish I were drunk right now.
I'm drunk in love with jhersh deckblad
what is this I don't even
don't play dumb, silly man... you know what love is.
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
I <3 u jhersh