我将 Firebase-auth 用于我使用电子框架开发的 Web 应用程序。我使用项目设置创建了一个 API 密钥,并按照 Firebase 指南中的建议将其复制到我的 html 正文中。但是,当我在浏览器上打开 HTML 页面时,控制台显示以下错误。
code: "auth/invalid-api-key"
message: "Your API key is invalid, please check you have copied it correctly."
__proto__: Error
Run Code Online (Sandbox Code Playgroud)
HTML 页面主体的底部如下所示。
<script src="https://www.gstatic.com/firebasejs/5.8.2/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyAXXXXXXXXXXXXXXXXXXXXjILO32ZDxRKY",
authDomain: "jumbleup-773da.firebaseapp.com",
databaseURL: "https://jumbleup-773da.firebaseio.com",
projectId: "jumbleup-773da",
storageBucket: "jumbleup-773da.appspot.com",
messagingSenderId: "971123072180"
};
firebase.initializeApp(config);
</script>
Run Code Online (Sandbox Code Playgroud)
注意:我通过用 X 改变它的 20 位数字来混淆真正的密钥。
javascript firebase typescript electron firebase-authentication
我正在尝试运行我的简单电子应用程序。我使用 Typescript 作为编译成 JavaScript 的开发语言。当我运行该应用程序时,出现以下错误:
ReferenceError: exports is not defined[Learn More]
file:///Users/ahmet/Documents/JumbleUp-Desktop/dist/Login/Login.js:5
exports.__esModule = true;
Run Code Online (Sandbox Code Playgroud)
我的 login.ts 文件看起来像这样
import firebase from "firebase";
firebase.auth().onAuthStateChanged(function(user) {
if (user) {
location.replace("index.html");
} else {
location.replace("login.html");
}
});
function login() {
const userEmail = (document.getElementById("inputEmail") as HTMLInputElement).value;
const userPassword = (document.getElementById("inputPassword") as HTMLInputElement).value;
firebase.auth().createUserWithEmailAndPassword(userEmail, userPassword).catch(function(error) {
// Handle Errors here.
var errorCode = error.code;
var errorMessage = error.message;
// ...
window.alert("Alert : " + errorMessage);
});
}
Run Code Online (Sandbox Code Playgroud)
这里是我的 tsconfig 文件
{
"compilerOptions": {
"module": …Run Code Online (Sandbox Code Playgroud) 虽然我阅读了文档,但我无法理解加载类时这两行 java codee 之间的区别:
Class<?> cls = Class.forName("jdk.nashorn.api.scripting.ScriptObjectMirror", false, enginClassLoader);
Class<?> cls = Class.forName("jdk.nashorn.api.scripting.ScriptObjectMirror", true, enginClassLoader);
Run Code Online (Sandbox Code Playgroud)
这里的布尔参数在文档中解释如下:
initialize 如果为真,类将被初始化。请参阅 Java 语言规范的第 12.4 节。
就我而言,即使我使用带有 false 参数的代码,它仍然有效。所以我想知道什么时候应该是真的?
我正在尝试使用流程构建器在我的 Java 应用程序中执行可视化基本脚本代码。由于用户提供的脚本可能无法及时完成执行,我想提供一种方法来限制此执行时间。在下面的代码中,你可以看到我的逻辑,但它并没有真正做它应该做的。我怎样才能使这个等待工作以限制执行时间?
private void run(String scriptFilePath) throws ScriptPluginException {
BufferedReader input = null;
BufferedReader error = null;
try {
ProcessBuilder p = new ProcessBuilder("cscript.exe", "//U", "\"" + scriptFilePath + "\"");
String path = "";
if (scriptFilePath.indexOf("/") != -1) {
path = scriptFilePath.substring(0, scriptFilePath.lastIndexOf("/"));
}
path += "/" + "tempvbsoutput.txt";
p.redirectOutput(new File(path));
Process pp = p.start();
try {
pp.waitFor(executionTimeout, TimeUnit.MINUTES);
} catch (InterruptedException e) {
SystemLog.writeError(jobId, ScriptConsts.COMPONENT_ID, "VBScriptExecutor", "run", 80401104,
"VB Script executes fail.");
}
if (!pp.isAlive()) {
pp.getOutputStream().close();
} …Run Code Online (Sandbox Code Playgroud) electron ×2
java ×2
typescript ×2
classloader ×1
commonjs ×1
firebase ×1
java-threads ×1
javascript ×1