examples/tokens.js
function newToken(){ // check if the client has all the tokens
	var allRetrieved = true;
	var tokens = client.getTokens();
	
	['auth', 'gvx', 'rnr'].forEach(function(type){
		if(!tokens.hasOwnProperty(type)){
			allRetrieved = false;
		}
	});
	
	if(allRetrieved){ // save tokens once all have been retrieved
		fs.writeFileSync('./tokens.json', JSON.stringify(tokens));
		console.log('\n\nALL TOKENS SAVED TO tokens.json')
	}
}
function newToken(){ // check if the client has all the tokens
	var allRetrieved = true;
	var tokens = client.getTokens();
	
	['auth', 'gvx', 'rnr'].forEach(function(type){
		if(!tokens.hasOwnProperty(type)){
			allRetrieved = false;
		}
	});
	
	if(allRetrieved){ // save tokens once all have been retrieved
		fs.writeFileSync('./tokens.json', JSON.stringify(tokens));
		console.log('\n\nALL TOKENS SAVED TO tokens.json')
	}
}
function newToken ( ) { // check if the client has all the tokens var allRetrieved = true ; var tokens = client . getTokens ( ) ; [ 'auth' , 'gvx' , 'rnr' ] . forEach ( function ( type ) { if ( ! tokens . hasOwnProperty ( type ) ) { allRetrieved = false ; } } ) ; if ( allRetrieved ) { // save tokens once all have been retrieved fs . writeFileSync ( './tokens.json' , JSON . stringify ( tokens ) ) ; console . log ( '\n\nALL TOKENS SAVED TO tokens.json' ) } }
This fn will monitor token events until all 3 tokens are retrieved. When all three are retrieved, they will be saved to tokens.json
This fn will monitor token events until all 3 tokens are retrieved . When all three are retrieved they will be saved to tokens . json