⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 writer.js

📁 原名JSPackager
💻 JS
字号:
/**
 * class for writing to character streams.
 * @public
 * @constructor
 * @author jindw
 */
function Writer(){
  this.buf = [];
}
/**
 * Write a string.
 * @public
 * @param  str  String to be written
 * @return <Writer> return itself
 */
Writer.prototype.print = function(str){
  for(var i=0;i<arguments.length;i++)this.buf.push(arguments[i]);
  return this;
}
/**
 * Write a string.
 * @public
 * @arguments  str...  String to be written
 * @return <Writer> return itself
 * @see #write
 */
Writer.prototype.write = function(){
  return this.print.apply(this,arguments);
}
/**
 * Write a string.
 * @public
 * @param  str  String to be written
 * @return <Writer> return itself
 */
Writer.prototype.println = function(str){
  for(var i=0;i<arguments.length;i++)this.buf.push(arguments[i]);
  this.buf.push('\r\n');
  return this;
}
/**
 * Write a string.
 * @public
 * @param  str  String to be written
 * @return <Writer> return itself
 * @see #write
 */
Writer.prototype.writeln = function(str){
  return this.println.apply(this,arguments);
}
/**
 * create a new String for the content
 * @public
 * @return <Writer> return itself
 */
Writer.prototype.clear = function(){
  this.buf.length = 0;
  return this;
}
/**
 * create a new String for the content
 * @public
 */
Writer.prototype.toString = function(){
  return this.buf.join('');
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -