Code Monkey home page Code Monkey logo

test-updater's Introduction

eResearch

简介

一个逐步完善的科研人员实用小工具合集,旨在促进科技发展,为世界进步尽一点绵薄之力。

features

日程管理

image

chatgpt

image

元素周期表

image

ftl

image

色温计算

image

IV 曲线计算

image

项目插件

功能开发过程

启动加载页面

1. 准备启动加载的静态文件

如根目录的loading.html

2. 准备触发/监听事件

// 事件处理器
import EventEmitter from "events";

// 加载事件总线 目前用来加载欢迎页
const loadingEvents = new EventEmitter();

// 监听 finished 事件
loadingEvents.on("finished", () => {});

// 触发 finished 事件
loadingEvents.emit("finished");

3. 创建加载欢迎页的方法

在内部设置定时起触发 finished 事件

// 创建欢迎页窗口
const welcomeWindow = new BrowserWindow();

// 加载欢迎页方法
const loadWelcomePage = () => {
  // 加载 loading.html
  welcomeWindow.loadURL("xxx/xxx/xxx/loading.html");

  // 定时起触发 finished 事件
  setTimeout(() => {
    loadingEvents.emit("finished");
  }, 5000);
};

4. 初始化后创建 loading 窗口

app准备的生命周期内开始加载loading.html

// 或 app.whenReady().then(() => { loadWelcomePage() });
app.on("ready", () => {
  loadWelcomePage();
});

5. 监听 finished 事件

监听到定时器内触发的 finished 事件,关闭欢迎页窗口,加载主窗口

// 监听加载 loadingEvents finished, 开始加载主页面
loadingEvents.on("finished", () => {
  // 关闭欢迎页
  welcomeWindow.close();
  // 创建程序主窗口
  createWindow(winParams);
});

自定义顶部工具栏的时候,加上这个样式才能进行拖拽移动

<TopHeader style="-webkit-app-region: drag" />

test-updater's People

Contributors

stefan-ysh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.