node-red-contrib-alexa-remote2-applestrudel
Version:
node-red nodes for interacting with alexa
25 lines (20 loc) • 515 B
JavaScript
'use strict';
class TokenStore {
constructor(globalContext) {
this.globalContext = globalContext;
this.key = 'alexaRemoteOAuth2';
}
get() {
if (!this.globalContext || typeof this.globalContext.get !== 'function') {
return null;
}
return this.globalContext.get(this.key) || null;
}
set(tokens) {
if (!this.globalContext || typeof this.globalContext.set !== 'function') {
return;
}
this.globalContext.set(this.key, tokens);
}
}
module.exports = { TokenStore };