javascript - promise js function call another function in same class -


इस सवाल का पहले से ही एक उत्तर है: < / P>

  • 5 जवाब

मैं एक कस्टम लॉगर और मैं एक स्क्रीनशॉट लेने के बाद जो भी करने की कोशिश कर रहा हूं, मैं छवि नाम को लॉग करने के लिए अपने लॉगर फ़ंक्शन को कॉल करना चाहता हूं। जब मैं वादा करता हूं तो यह कक्षा में सभी कार्यों को नहीं देख सकता

  module.exports = {takeScreenshot: function (driver, filename) {driver.takeScreenshot ()। फिर ( फ़ंक्शन (डेटा) {name = filename} 'ss.png'; var screenshotPath = 'results / screenshots /'; fs.writeFileSync (screenshotPath + name, डेटा, 'base64'); वापसी स्क्रीनशॉट पाथ + नाम;})। फिर (फ़ंक्शन (e) {this.logger (e, "true");}); }, लकड़हारा: फ़ंक्शन (लॉग, स्क्रीनशॉट) {isScreenshot = screenshot || "असत्य"; Var obj = {}; अगर (isScreenshot == "true") {obj [testName.replace (/ / g, '')] = {लॉग्स: "", स्क्रीनशॉट: "& lt; img src = \" "+ + + +" \ "class = \ "परीक्षण-आईएमजी \" / & gt; " }; logger.push (obj); } अन्य {obj [testName.replace (/ / g, '')] = {लॉग्स: "& lt; span class = \" test-log \ "& gt;" + लॉग + "& lt; / span & gt;", स्क्रीनशॉट: ''}; logger.push (obj); }}}  

असल में यह लॉगर विधि नहीं देख रहा है मैं क्या खो रहा हूँ? धन्यवाद

आपका यह अलग है।
अधिक जानकारी के लिए पढ़ें के बारे में यह

  लेफ्टसॉटसः फ़ंक्शन (चालक, फ़ाइलनाम) {var self = this; Driver.takeScreenshot ()। तब (फ़ंक्शन (डेटा) {name = filename || 'ss.png'; var screenshotPath = 'results / screenshots /'; fs.writeFileSync (screenshotPath + name, डेटा, 'base64'); वापसी ScreenshotPath + name;})। तब (फ़ंक्शन (ई) {self.logger (e, "true");}); },  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -