本文整理汇总了TypeScript中minpubsub/minpubsub.publish函数的典型用法代码示例。如果您正苦于以下问题:TypeScript publish函数的具体用法?TypeScript publish怎么用?TypeScript publish使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了publish函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
var testNLP = function() {
counter++;
var testString = null;
switch (counter) {
case 1 : testString = "Bill Clinton was president from 1992 to 2000. He is not the president any more."; break;
case 2 : testString = "Santa Claus is coming to town."; break;
case 3 : console.log("NLP server status: ", nlpServer.getStatus().getState());
events.publish(SERVER_AVAILABLE);
break;
case 4 : nlpServer.stop(); break;
}
// Process the string using the NLP library and print the result.
// Then fire another event to trigger the function again.
if (testString) {
nlpServer.process(testString,
function(result) {
console.log(JSON.stringify(JSON.parse(result), null, " "));
events.publish(SERVER_AVAILABLE);
});
}
}
示例2:
nlpServer.start(function() {
events.publish(SERVER_AVAILABLE);
});