documentation of notification messages
I'm in the process of reverse-engineering the notifications that are generated when items are added, deleted, modified, added to a collection, when collections are moved etc. etc. The intent of this is to set up a distributed notification mechanism for a specialized collaboration extension. To reverse engineer the notifications, I'm using a simple modification of the notification call-back handler in the "Hello World" extension along with the code below to dump the four objects that are passed to the call-back.
At any rate, I would be happy to post the notes that I'm gathering on the notification messages, if there is general interest.
Regarding the code below -- maybe everyone but me knows how to dump JavaScript objects, but here's some code just in case. The output is "JSON-ish" and could be made into pure JSON with a little work. In fact, I plan to do this and I'll probably post that code as well
// dump object code adapted from here:
// http://weblogs.asp.net/skillet/archive/2006/03/23/440940.aspx
// usage e.g.: alert(dumpObj(extraData, "extraData", "", 0));
function dumpObj(obj, name, indent, depth) {
if (depth > 10) {
return indent + name + ": \n";
}
if (typeof obj == "object") {
var child = null;
var output = indent + name + "\n";
indent += "\t";
for (var item in obj)
{
try {
child = obj[item];
}
catch (e) {
child = "";
}
if (typeof child == "object") {
output += dumpObj(child, item, indent, depth + 1);
}
else {
output += indent + item + ": " + child + "\n";
}
}
return output;
}
// --- else ...
return obj;
}
At any rate, I would be happy to post the notes that I'm gathering on the notification messages, if there is general interest.
Regarding the code below -- maybe everyone but me knows how to dump JavaScript objects, but here's some code just in case. The output is "JSON-ish" and could be made into pure JSON with a little work. In fact, I plan to do this and I'll probably post that code as well
// dump object code adapted from here:
// http://weblogs.asp.net/skillet/archive/2006/03/23/440940.aspx
// usage e.g.: alert(dumpObj(extraData, "extraData", "", 0));
function dumpObj(obj, name, indent, depth) {
if (depth > 10) {
return indent + name + ": \n";
}
if (typeof obj == "object") {
var child = null;
var output = indent + name + "\n";
indent += "\t";
for (var item in obj)
{
try {
child = obj[item];
}
catch (e) {
child = "";
}
if (typeof child == "object") {
output += dumpObj(child, item, indent, depth + 1);
}
else {
output += indent + item + ": " + child + "\n";
}
}
return output;
}
// --- else ...
return obj;
}