[英]Print each emit in Node.js
I'm trying to print my Messages in a Node.JS/Socket.JS Web-App. 我正在尝试在Node.JS / Socket.JS Web应用程序中打印消息。 In Firefox I've made the option, that he doesn't popup the normally Print-Dialog.
在Firefox中,我选择了以下选项:他不弹出通常的“打印对话框”。
Now my Code is: 现在我的代码是:
$(document).ready(function(){
// WebSocket
var socket = io.connect();
//register Printer
socket.emit('join', {name:"print-direct"});
// neue Nachricht
var a = 0;
socket.on('msg', function (data) {
var zeit = new Date(data.zeit);
var innerHTML = $('#content_text').html();
$('#content_text').html(innerHTML+'<div class="msg" id="'+a+'">Name "+data.name+'</font><br><font size="+2">'+data.msg+'</font></div>');
$('#'+a).printElement();
$("#"+a).remove();
a++;
});
});
Do you Have an idea how i can fix this? 你有想法我可以解决这个问题吗?
Thanks! 谢谢!
PS: This is the Print-Plugin I've used http://projects.erikzaadi.com/jQueryPlugins/jQuery.printElement/ PS:这是我使用过的Print-Plugin http://projects.erikzaadi.com/jQueryPlugins/jQuery.printElement/
Sorry my rep is too low to comment, but is this code in your front-end? 抱歉,我的代表评论太低,但是此代码在您的前端吗? If so, you can simply use console.log in your javascript and it will show up in your developer console in Firefox.
如果是这样,您只需在JavaScript中使用console.log,它将显示在Firefox的开发人员控制台中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.