跳到主要內容

發表文章

Could not locate the bindings file. Tried: (nodejs壞掉的時候可以試試看)

I get the following error when running  dapple test  in the dappsys repo. $ dapple test /Users/piper/.node/lib/node_modules/dapple/node_modules/bindings/bindings.js:91 throw err ^ Error: Could not locate the bindings file. Tried: → /Users/piper/.node/lib/node_modules/dapple/node_modules/deasync/build/deasync.node → /Users/piper/.node/lib/node_modules/dapple/node_modules/deasync/build/Debug/deasync.node → /Users/piper/.node/lib/node_modules/dapple/node_modules/deasync/build/Release/deasync.node → /Users/piper/.node/lib/node_modules/dapple/node_modules/deasync/out/Debug/deasync.node → /Users/piper/.node/lib/node_modules/dapple/node_modules/deasync/Debug/deasync.node → /Users/piper/.node/lib/node_modules/dapple/node_modules/deasync/out/Release/deasync.node → /Users/piper/.node/lib/node_modules/dapple/node_modules/deasync/Release/deasync.node → /Users/piper/.node/lib/node_modules/dapple/node_modules/deasync/build/default/deasync.node → /Users/piper/.node/lib/...

淺談 JavaScript 的 Promise

https://marco79423.net/articles/%E6%B7%BA%E8%AB%87-javascript-%E7%9A%84-promise/ 淺談 JavaScript 的 Promise 分類: 程式設計 Javascript 發表時間:2018/02/24 本文會著重介紹 ES2015 定義的原生 Promise,除了基本的用法和個人使用心得外,還會補充一些原生 Promise 不足處的可能解決方案。適合完全沒用過 Promise 的生手閱讀,以上。 總之,讓我們開始吧! *** 實用工具誕生的目的,就是為了解決我們生活中碰到的種種問題。 身為宅男工程師,我們碰到最大的問題就是--沒女朋友。 當然不是說 Promise 可以充當女友,畢竟也沒悲情到這種地步……吧?也……也許?嗯嗯……但善用 Promise 可以解決許多我們在「追女友」遇到的麻煩。 怎麼說呢?事情是這樣子的…… 妹子的矜持 - 事情不是同步的 首先,理想中追女友的情況: // 告白服務由「心儀妹子」獨家提供 const yes = 告白服務 . 告白 ( 心儀妹子 , 我 ) if ( yes ) { // 耶~去看電影! } else { // 哭哭,去酒吧買醉 T^T } 但事情遠非如此簡單。 現實中,妹子並不會立即回覆「告白」,她們需要時間醞釀、考慮、權衡利弊,經過閨密投票等多道複雜手續,才能給予最後審核結果。 即使妹子心中早已有答案,流程也是必要的。縱然心中千想萬想,仍得故作矜持,給予懸念。如此你在得到她後,能更加珍惜;反之,她完全看不上你,同樣也得等一段時間,表示她「真的」有在考慮…… 是以現實妹子實際提供的「介面」更像是這般: // 心儀妹子透過「回覆函式」事後回傳結果。 告白服務 . 告白 ( 心儀妹子 , 我 , function 回覆函式 ( yes ) { if ( yes ) { // 耶~去看電影! } else { // 哭哭,去酒吧買醉 T^T } }) 「告白」函式執行後,不會立即回傳結果,而是透過「回覆函式」回傳。此種...