猿问

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
浏览 1669回答 1
1回答
随时随地看视频慕课网APP
我要回答