TIL: nextron.js (3) Electron APIs, building demo app - 220716

Lumpen·2022년 7월 16일
0

TIL

목록 보기
86/242

nextron

https://blog.logrocket.com/building-app-next-js-electron/

electron APIs

브라우저 기반 API와 Electron API도 원활하게 작동하며
모든 페이지로 직접 가져올 수 있다
아래와 같은 페이지에서 활용할 수 있는 브라우저 알림 API가 있다

const showNotification = () => {
  const notificationTitle = "My Notification 🔔";

  new Notification(notificationTitle, {
    body: "This is a sample notification.",
  }).onclick = () => console.log("Notification Clicked");
};

showNotification 기능을 트리거하는 작업을 수행할 때마다 바탕 화면에 즉시 알림이 표시된다

macOS 알림의 예시

building demo app

응용 프로그램 코딩을 마치면 다른 사람과 응용 프로그램을 공유할 수 있도록 실행 파일을 생성하고 싶을 것입니다. Nextron은 전자 빌더 로 이를 처리합니다 . 아래 명령을 사용하여 Nextron 프로젝트에 대한 실행 파일을 생성할 수 있습니다.

npm run build
// OR
yarn build

다른 빌드 옵션을 포함하도록 파일 의 스크립트 섹션을 업데이트할 수도 있습니다.package.json

{
  "scripts": {
    "build": "nextron build",
    "build:all": "nextron build --all",
    "build:win32": "nextron build --win --ia32",
    "build:win64": "nextron build --win --x64",
    "build:mac": "nextron build --mac --x64",
    "build:linux": "nextron build --linux"
  }
}

따라서 Windows 64비트용 실행 파일을 생성하려면 다음 명령을 사용합니다.

npm run build:win64
// OR
yarn build:64
profile
떠돌이 생활을 하는. 실업자는 아니지만, 부랑 생활을 하는

0개의 댓글