Closed imyelo closed 10 years ago
Thanks. 确实应该这么做
On Fri, Dec 6, 2013 at 3:57 PM, yelo notifications@github.com wrote:
较为理想的写法: publish
fw.publish('something', 'pub-something', function(callback) { var options = { host: HOST, path: PATH, json: true }; var param = { foo: 'bar' }; var cb = function (data) { var result = []; var err; try { data = JSON.parse(data.toString()); (data.list instanceof Array) && (result = data.list); } catch (e) { err = e; } callback(err, result); // or callback(result); } sumeru.external.post(options, param, cb); });
subscribe
session.something = env.subscribe('pub-something', somethingId, function(err, collection) { var data; if (err) { console.log(err); return session.bind('tpl',{ err: err, }); } return session.bind('tpl', { data: collection }); });
— Reply to this email directly or view it on GitHubhttps://github.com/brandnewera/clouda/issues/78 .
更理想的写法: publish
subscribe