Hi,

I have a requirement of  publishing data on load of publisher gadget. I
have following script

$(function () {

    var TOPIC = "publisher";

    var count = 1;

    cb(moment().subtract(29, 'days'), moment());

    function cb(start, end) {
        if (count != 0) {
            var message = {
                timeFrom: new Date(start).getTime(),
                timeTo: new Date(end).getTime()
            };
            console.log(message);
            gadgets.Hub.publish(TOPIC, message);
        }
        count++;
    }

});


As you can see I'm calling cb(moment().subtract(29, 'days'), moment());
which will publish that data. If I comment above line and call the function
when a button click then publisher works. It seems publisher functionality
is not available or gadget is not properly loaded if we call as above. Am I
missing something here ? or is there a better way to achieve this ?

Thanks,
Damith.


-- 
Software Engineer
WSO2 Inc.; http://wso2.com
<http://www.google.com/url?q=http%3A%2F%2Fwso2.com&sa=D&sntz=1&usg=AFQjCNEZvyc0uMD1HhBaEGCBxs6e9fBObg>
lean.enterprise.middleware

mobile: *+94728671315*
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to