当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript slate-irc.default方法代码示例

本文整理汇总了TypeScript中slate-irc.default方法的典型用法代码示例。如果您正苦于以下问题:TypeScript slate-irc.default方法的具体用法?TypeScript slate-irc.default怎么用?TypeScript slate-irc.default使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在slate-irc的用法示例。


在下文中一共展示了slate-irc.default方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: connect

function connect() {
  if (socket != null) return;

  statusChatTab.addInfo(`Connecting to ${ircNetwork.host}:${ircNetwork.port}...`);
  for (const name in channelChatTabs) channelChatTabs[name].addInfo("Connecting...");
  for (const name in privateChatTabs) privateChatTabs[name].addInfo("Connecting...");

  socket = tls.connect({ host: ircNetwork.host, port: ircNetwork.port, rejectUnauthorized: false }) as any as net.Socket;
  socket.on("error", onSocketError);

  irc = SlateIRC(socket);
  irc.on("welcome", onWelcome);
  irc.on("motd", onMOTD);
  irc.on("join", onJoin);
  irc.on("part", onPart);
  irc.on("nick", onNick);
  irc.on("away", onAway);
  irc.on("quit", onQuit);
  irc.on("data", onData);
  irc.on("message", onMessage);
  irc.on("notice", onNotice);
  irc.on("disconnect", onDisconnect);

  irc.nick(settings.nickname);
  irc.user(settings.nickname, settings.nickname);
}
开发者ID:AgileJoshua,项目名称:superpowers-app,代码行数:26,代码来源:index.ts

示例2: SlateIRC

/// <reference path="slate-irc.d.ts" />

import * as net from "net";
import * as SlateIRC from "slate-irc";

let socket: net.Socket;
const client = SlateIRC(socket);

client.on("welcome", (name) => {
  console.log(client.me);
});

client.on("motd", (event) => {
  console.log(event.motd);
});

client.on("join", (event) => {
  console.log(`${event.nick} has joined ${event.channel}`);
});

client.on("part", (event) => {
  console.log(`${event.nick} has parted ${event.channels.join(", ")}`);
});

client.on("nick", (event) => {
  console.log(`${event.nick} is now known as ${event.new}`);
});

client.on("quit", (event) => {
  console.log(`${event.nick} has quit (${event.message}).`);
});
开发者ID:0815fox,项目名称:DefinitelyTyped,代码行数:31,代码来源:slate-irc-tests.ts


注:本文中的slate-irc.default方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。