⚡️ JavaScript | Just JS Things

All things JavaScript.

    // register email and password to firebase
    export function registerUser(email, password) {
        firebase.auth().createUserWithEmailAndPassword(email, password)
            .then(cred => {
                console.log("User successfully created!");
                // clear inputs
                document.getElementById('login').value = '';
                document.getElementById('password').value = '';
            }).catch(err => {
                console.log(err.message);
            })
    }
    
    // log into app
    // creation of object for neural network
    function createNetworkObject(r,g,b){
    	let networkObject = {r:null, g:null, b:null};
    	networkObject.r = r/255;
    	networkObject.g = g/255;
    	networkObject.b = b/255;
    
    	return networkObject;
    }
    // Machine learning probability label - determining the result
    function networkLabel(result){
    	if(result.light > result.dark){
    			result = 'light';
    		} else {
    // How to get started - Chatkit documentation for JS can be found at:
    // https://pusher.com/docs/chatkit/quick_start/javascript
    
    const tokenProvider = new Chatkit.TokenProvider({
      url: "https://us1.pusherplatform.io/services/chatkit_token_provider/v1/d3449670-b38c-4ecb-bc76-14ca778e1138/token"
    });
    
    
    const chatManager = new Chatkit.ChatManager({
      instanceLocator: "v1:us1:d3449670-b38c-4ecb-bc76-14ca778e1138",
      userId: "test", 
      tokenProvider: tokenProvider
    });
    
Various casts demonstrating things in JavaScript