HowProgrammingWorks / HowProgrammingWorks/AsynchronousProgramming
`.do` arguments not passed correctly
還沒有人認領這個 Issue。
- 主要語言
- JavaScript
- 星號
- 23
- 分支
- 26
- PR 合併指標
- 30 天內沒有已合併 PR
描述
The current implementation of the callback chain in 5a-chain passes data from the previous callback but doesn't pass arguments explicitly mentioned in .do().
In usage example readConfig callback is expected to receive myConfig as an argument.
const startChain = chain()
.do(readConfig, 'myConfig')
.do(selectFromDb, 'select * from cities')
.do(getHttpPage, 'http://kpi.ua')
.do(readFile, 'README.md');
However it receives undefined instead.
So if callbacks would really depend on the previous one the chain would fail once it was called.
Also, should only the first callback in the chain receive an explicit argument, and the following ones receive their arguments from the previous one? Or should they receive both explicit and implicit arguments?
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先檢查 5a-chain 中的 callback 鏈實作,以及展示 readConfig、selectFromDb、getHttpPage 和 readFile 的使用範例。追蹤引數如何透過每次 .do() 呼叫傳遞,然後驗證文件中所述的 callback 是否接收到預期的明確引數和前一個 callback 的引數,而不是 undefined。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- javascript
- 領域
- backend
- Issue 類型
- 缺陷
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100