goma smile Posted March 22, 2016 Report Share Posted March 22, 2016 Piemērs tieši no: https://www.npmjs.com/package/is-online Apakša ExpressJs: var isOnline = require('is-online'); isOnline(function(err, online) { console.log(online); //=> true }); ieliekot šo routes viss iet konsolē atgriež true vai false... bet kā man pārrakstīt šo funkciju lai es viņu varētu lietot kā mainīgo.. piemēram var networkStatuss = isOnline(function(err, online) { return online; }); console.log(networkStatuss) // Atgriež undefined Quote Link to comment Share on other sites More sharing options...
0 F3llony Posted March 22, 2016 Report Share Posted March 22, 2016 https://www.npmjs.com/package/is-online#isonlinecallback Kas ir pirmais arguments? Quote Link to comment Share on other sites More sharing options...
0 Wuu Posted March 22, 2016 Report Share Posted March 22, 2016 Tā nav sinhrona funkcija, lai tā darītu! var isOnline = require('is-online') var networkStatuss = () => { isOnline((err, online) => { console.log('1') }) console.log('2') } console.log(networkStatuss()) Quote Link to comment Share on other sites More sharing options...
Question
goma smile
Piemērs tieši no: https://www.npmjs.com/package/is-online
Apakša ExpressJs:
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.