node.js第二天的this是什么意思?

'use strict'


var Promise = require('bluebird')

var request = Promise.promisify(require('request'))

var util = require('./util')



var prefix = 'https://api.weixin.qq.com/cgi-bin/'

var api = {

accessToken: prefix + 'token?grant_type=client_credential'

}

function Wechat(opts) {

var that = this

this.appID = opts.appID

this.appSecret = opts.appSecret

this.getAccessToken = opts.getAccessToken

this.saveAccessToken = opts.saveAccessToken


this.getAccessToken()

.then(function(data) {

try {

data = JSON.parse(data)

}

catch(e) {

return that.updataAccessToken()

}


if (that.isValidAccessToken(data)) {

Promise.resolve(data)

}

})

.then(function(data) {

that.access_token = data.access_token

that.expires_in = data.expires_in


that.saveAccessToken(data)

})

}


this.appID中的this是指哪个= =?

macheng617
浏览 1672回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP