Table of contents
    No headers
    dekiapi();
    var channel = $subscribe ?? 'default';
    var store = $id ?? 'data';
    <script type="text/jem">"
    	Deki.subscribe('" .. string.escape(channel) .. "', null, function(c, m, d) {
    		var prop = 'urn:custom.mindtouch.com#'  + '"..store.."';
    		MindTouch.Deki.ReadPageProperty(null, prop, function(result) {
    			var data = eval('(' + (result.value || '[]') + ')');
    			data.push(m);
    			if(result.etag) {
    				MindTouch.Deki.UpdatePageProperty(result.href, YAHOO.lang.JSON.stringify(data), result.etag, function() {
    					alert('Thank you. The information has been submitted.');
    				}, function(result) {
    					alert('An error occurred trying to update the store (status: ' + result.status + ' - ' + result.text + ')');
    				});
    			} else {
    				MindTouch.Deki.CreatePageProperty(null, prop, YAHOO.lang.JSON.stringify(data), function() {
    					alert('Thank you. The information has been submitted.');
    				}, function(result) {
    					alert('An error occurred trying to create the store (status: ' + result.status + ' - ' + result.text + ')');
    				});
    			}
    		}, function(result) {
    			alert('An error occurred trying to read the store (status: ' + result.status + ' - ' + result.text + ')');
    		});
    	}, null);
    "</script>
    
    Tag page
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by