0
self.getDocumentCount().then(function (text) {
var stringArray = text.split("(");
count = stringArray[0].trim();
}).then(function() {
self.logger.info("Document text : " + count, self);
});
self.logger.info("Checking the count again : " + count, self);
我無法獲得承諾外的價值。無法在量角器中分配承諾範圍外的變量
我用的量角器+的JavaScript +茉莉
'getDocumentCount()'這是什麼輸出?我的意思是console.log(文本)給你什麼輸出? –
承諾內的console.log(文本)爲我提供了文檔數量(即所需的結果)。如果我試圖在承諾之外獲取相同的值,我將得到undefined –
因此,不能將結果存儲在承諾中返回的結果中嗎? –