Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poor documentation. #25

Closed
grimz11 opened this issue Jul 25, 2020 · 6 comments
Closed

Poor documentation. #25

grimz11 opened this issue Jul 25, 2020 · 6 comments

Comments

@grimz11
Copy link

grimz11 commented Jul 25, 2020

You should consider that someone just want a detailed explaination on how this library works. I just learned Electron and I don't know how to implement this. Can you at least give more detail to this one?

import { app, BrowserWindow} from "electron";
import * as path from "path";
// import * as url from "url";
const serve = require('electron-serve');

let mainWindow: Electron.BrowserWindow | null;

const loadURLs = serve({directory: path.join('file:///', __dirname, "../build/index.html")});

  async function createWindow() {
  await app.whenReady();
  // Create the browser window.electron
  mainWindow = new BrowserWindow({
    height: 600,
    webPreferences: {
      webSecurity: false,
      preload: path.join(__dirname, "preload.js"),
    },
    width: 1400,
  });
  console.log(path.join('://-', __dirname, "../build/index.html"));
  console.log('LoadUrl', {loadURLs});
  
  await loadURLs(mainWindow.loadURL(path.join('://', __dirname, "../build/index.html")));  

  mainWindow.webContents.on('did-start-navigation', () => {
    //if()
    // mainWindow.loadFile(path.join(__dirname, "index.html#/user/login"));
    // mainWindow.loadFile(path.join(__dirname, "index.html#/"));
  });

  // Open the DevTools.
  mainWindow.webContents.openDevTools();

  // Emitted when the window is closed.
  mainWindow.on("closed", () => {
    // Dereference the window object, usually you would store windows
    // in an array if your app supports multi windows, this is the time
    // when you should delete the corresponding element.
    mainWindow = null;
  });
  
}```

Look what I'm doing here. :)
@sindresorhus
Copy link
Owner

Can you please elaborate on what kind of details you think are missing?

@sindresorhus
Copy link
Owner

I don't intend to document how Electron itself works. It's expected that you familiarize yourself with Electron through the official docs.

@grimz11
Copy link
Author

grimz11 commented Jul 26, 2020

Do we need electron-store dependency
or other libarary to make this work?

@sindresorhus
Copy link
Owner

I don't understand the question. Make what work?

@grimz11
Copy link
Author

grimz11 commented Jul 26, 2020

Okay, as what I have seen from the repo that uses your library. They have some kind of boilerplate that uses "electron-store here's the link. Do I need to use it as well? My problem is that I embedded my react app to electron, it doesn't work when i build it. The homepage work in first load or when I reload it but when I navigate away from the homepage I got ERR_File_notfound in my network tab E://. And I've come to have read that this is an issue to SPA and I found your library. How do I implement this?

@sindresorhus
Copy link
Owner

This is not the place to ask such questions. The issue tracker is for actual issues and feature requests. I would try Stack Overflow instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants