ibmsbt - load function declared in service objects doesn't execute -
trying communities list(and profile well) using javascript ibmsbt api passing object load function getmycommunities function has no result. function assigned load property doesn't executed. here code:
var communityservice = new communityservice(); communityservice.getmycommunities({ load: function(communities) { var ul = document.getelementbyid("communities") (var i=0; i<communities.length; i++) { var community = communities[i]; var li = document.createelement("li"); ul.appendchild(li); li.setattribute("id", "community" + i); dom.settext("community" + i, community.gettitle()); } }, error: function(error) { console.error("error: "+error.message); } });
but when i'm using promises works charm. here is:
var cp = communityservice.getmycommunities(); cp.then( function(communities){ var ul = document.getelementbyid("communities") (var i=0; i<communities.length; i++) { var community = communities[i]; var li = document.createelement("li"); ul.appendchild(li); li.setattribute("id", "community" + i); dom.settext("community" + i, community.gettitle()); } }, function(error){ console.error("error: " + error.message); });
api documentation on part of load function says: this function invoked when call communities completes. function expects receive 1 parameter, communities object - array of communities. api doc
what missing?
our api documentation out of date. support promise syntax asynchronous calls. i'll api documentation updated in meantime can use documentation in sdk download.
regards mark
Comments
Post a Comment