Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Writing to console.log specifically

未關閉
#406 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
文件
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
ruby, wasm
領域
documentation

研究方向

從涉及 $stdout、JS.global 和瀏覽器輸出的 FAQ 範例開始。確定 ruby.wasm 是否已經提供一條在替換 $stdout 後仍可用的 console.log 路徑;如果有,請在 FAQ 中記錄它;如果沒有,請在提出實作方案之前定義缺少的能力。只有在 console.log 的行為及其與重新導向 stdout 的互動得到清楚記錄後,才算完成。

由索引模型根據 Issue 內容生成。

描述

In the FAQ currently we have code like this:

 $stdout = Object.new.tap { |obj|
  def obj.write(i)
    JS.global[:document].write(i)
  end
}

Then we can simply use puts, which is convenient.

But how to write to console.log?

Past this point if we use:

JS.global[:document].write "foobar"

It will no longer write to console.log, instead just to primary stdout in the browser.

Is there a way to still write to console.log somehow? Could this be added to FAQ?

If not, could there be a way to show this? I'd like to get debug-like output right
via console.log() as well, so being able to write onto console.log even when having
modified $stdout, would be convenient, in my opinion. Could such a way be added
in addition to ruby.wasm?

主要語言
Ruby
星號
875
分支
68
平均合併
9 天 5 小時
30 天內合併 PR
1

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

ruby/ruby.wasm 的其他 Issue

查看 ruby/ruby.wasm 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。