johnnyJ Posted July 5, 2018 Report Posted July 5, 2018 Hi!When I try to use any steam-user methods I'm receiving this error https://imgur.com/4xqZZlbCode: function logout() { const remote = require('electron').remote; const SteamUser = require('steam-user'); const client = new SteamUser(); localStorage.setItem("userID", ""); client.logOff(); var window = remote.getCurrentWindow(); window.close(); } func set onclick eventMethods are working but only from the second clickevent on first im getting that error. Quote
Dr. McKay Posted July 6, 2018 Report Posted July 6, 2018 Looks like you're executing the JavaScript in the browser context and not in the Node.js context. Quote
johnnyJ Posted July 6, 2018 Author Report Posted July 6, 2018 (edited) Looks like you're executing the JavaScript in the browser context and not in the Node.js context.Ok so now I'm using it in Node.js and my script started working with first click event but I'm still receiving that error and if I remove const SteamUser = require('steam-user');const client = new SteamUser(); from logout() like this: const SteamUser = require('steam-user'); const client = new SteamUser(); function logout() { const remote = require('electron').remote; localStorage.setItem("userID", ""); client.logOff(); var window = remote.getCurrentWindow(); window.close(); } Im getting Uncaught ReferenceError: client is not defined Edited July 6, 2018 by johnnyJ Quote
johnnyJ Posted July 9, 2018 Author Report Posted July 9, 2018 I add reactJS to my project and I connect steam-user module and i also get this error https://i.imgur.com/46tHB1W.pngI'm running my project with npm start import React, { Component } from 'react' import LoginForm from './LoginForm' import SteamGuardForm from './SteamGuardForm' const SteamUser = require('steam-user') let client = new SteamUser() export default class Login extends Component { state = { accountName: "", password: "", steamGuardCode: "" } inputChangeHandler = (event) => { this.setState({ [event.target.id]: event.target.value }) } loginHandler = () => { // sessionStorage.setItem("promptSteamGuard", true) } render() { return( <div className="welcome-container"> <LoginForm accountName={this.state.accountName} password={this.state.password} inputChange={this.inputChangeHandler} tryLogin={this.loginHandler} /> <SteamGuardForm steamGuardCode={this.state.steamGuardCode} inputChange={this.inputChangeHandler} /> </div> ) } } "scripts": { "start": "nf start", "react-start": "react-scripts start", "electron-start": "node electron-wait-react", "build": "react-scripts build", "test": "react-scripts test --env=jsdom", "eject": "react-scripts eject", "electron": "electron .", "ebuild": "yarn build && node_modules/.bin/build" }, Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.