文件最后提交记录最后更新时间
add some doc about api 7 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
!20 merge docs/update-api-topic into master docs/update browserwindow doc Created-by: zhangqingnan_codeing Commit-by: zhangqingnan_codeing Merged-by: ohci1 Description: ### 一、内容说明(相关的Issue) 建议测试完成时间:xxxx.xx.xx 投产上线时间:xxxx.xx.xx 提测地址:CI环境/压测环境 测试账号: * 3.1 关联PR列表 * 3.2 数据库和部署说明 1. 常规更新 2. 重启unicorn 3. 重启sidekiq 4. 迁移任务:是否有迁移任务,没有写 "无" 5. rake脚本:bundle exec xxx RAILS_ENV = production;没有写 "无" * 3.4 其他技术优化内容(做了什么,变更了什么) - 重构了 xxxx 代码 - xxxx 算法优化 * 3.5 废弃通知(什么字段、方法弃用?) * 3.6 后向不兼容变更(是否有无法向后兼容的变更?) 自测测试结论: 检查点: | 需求名称 | 是否影响xx公共模块 | 是否需要xx功能 | 需求升级是否依赖其他子产品 | |------|------------|----------|---------------| | xxx | 否 | 需要 | 不需要 | | | | | | 接口测试: 性能测试: 并发测试: 其他: See merge request: openharmony-sig/electron!20 1 个月前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
add some doc about api 7 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
add some doc about api 7 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
docs: update API documentation from Excel (12 modules, 195 APIs) 20 天前
README.md

app API 列表

本模块包含 108 个 API。

Events(事件)

API 说明 鸿蒙支持
will-finish-launching 在应用程序完成基础启动时触发。在 Windows 和 Linux 上与 ready 事件相同;在 m 支持
ready Electron 完成初始化后触发一次。在 macOS 上,若应用从通知中心启动,launchInf 支持
window-all-closed 所有窗口都关闭时触发。 支持
before-quit 应用程序开始关闭窗口前触发。调用 event.preventDefault() 可阻止默认的退出行为 支持
will-quit 所有窗口已关闭且应用即将退出时触发。调用 event.preventDefault() 可阻止默认的 支持
quit 应用程序退出时触发。 支持
open-file 用户想用应用程序打开文件时触发。通常在应用已运行、操作系统需要复用该应用打开文件时触发。 支持
open-url 用户想用应用程序打开 URL 时触发。需在 Info.plist 的 CFBundleURLType 支持
activate 应用程序被激活时触发。首次启动、尝试重新启动已运行的应用,或点击应用的 Dock/任务栏图标等操作均 不支持
did-become-active 应用程序变为活跃状态时触发。与 activate 事件不同,每次应用变为活跃状态都会触发,而不仅限于 不支持
did-resign-active 应用程序不再活跃且失去焦点时触发。例如点击其他应用程序,或通过 macOS 应用切换器切换到其他应用 不支持
continue-activity 通过 Handoff 从其他设备恢复 NSUserActivity 活动时触发。 不支持
will-continue-activity 即将通过 Handoff 从其他设备恢复 NSUserActivity 活动前触发。 不支持
continue-activity-error 通过 Handoff 恢复 NSUserActivity 活动失败时触发。 不支持
activity-was-continued 本机的 NSUserActivity 活动成功通过 Handoff 在其他设备上恢复后触发。 不支持
update-activity-state Handoff 即将在其他设备上恢复 NSUserActivity 活动时触发,可在此时更新活动状态 不支持
new-window-for-tab 用户点击 macOS 原生新建标签页按钮时触发。仅当当前 BrowserWindow 设置了 tab 不支持
browser-window-blur browserWindow 失去焦点时触发。 支持
browser-window-focus browserWindow 获得焦点时触发。 支持
browser-window-created 新的 browserWindow 创建时触发。 支持
web-contents-created 新的 webContents 创建时触发。 支持
certificate-error 验证 URL 的证书失败时触发。可调用 event.preventDefault() 并执行 cal 支持
select-client-certificate 请求客户端证书时触发。 不支持
login webContents 或工具进程需要进行 HTTP 基础认证时触发。 支持
gpu-info-update GPU 信息更新时触发。 支持
render-process-gone 渲染进程意外消失时触发,通常是由于进程崩溃或被终止。 支持
child-process-gone 子进程意外消失时触发,包含进程退出状态信息。 支持
accessibility-support-changed Chrome 辅助功能支持状态发生变化时触发,参数指示辅助功能是否已启用。 支持
session-created Electron 创建新 session 时触发。 支持
second-instance 当第二个实例启动并调用 app.requestSingleInstanceLock() 时,在主实例 不支持

Methods(方法)

API 说明 鸿蒙支持
app.quit() 尝试关闭所有窗口,会先触发 before-quit 事件。 支持
app.exit([exitCode]) 以指定的 exitCode 立即退出应用,默认 exitCode 为 0。 支持
app.relaunch([options]) 当前实例退出后重新启动应用。 支持
app.isReady() 返回 boolean,若 Electron 已完成初始化则返回 true,否则返回 false。 支持
app.whenReady() 返回 Promise,在 Electron 初始化完成后 resolve。 支持
app.focus([options]) 使应用程序获得焦点。 支持
app.hide() 隐藏所有应用程序窗口,但不最小化它们。 不支持
app.isHidden() 返回 boolean,若应用程序(包括所有窗口)处于隐藏状态(如通过 Command-H)则返回 t 不支持
app.show() 显示隐藏的应用程序窗口,不会自动使其获得焦点。 支持
app.setAppLogsPath([path]) 设置或创建应用日志目录,之后可通过 app.getPath() 或 app.setPath() 操作 支持
app.getAppPath() 返回 string,当前应用程序的目录路径。 支持
app.getPath(name) 返回 string,与 name 关联的特殊目录或文件路径。userData 默认为 appData 支持
app.getFileIcon(path[, options]) 返回 Promise,resolve 为 NativeImage 类型的应 支持
app.setPath(name, path) 覆盖与 name 关联的特殊目录或文件路径。若指定路径的目录不存在则抛出错误。 支持
app.getVersion() 返回 string,当前应用的版本号。 支持
app.getName() 返回 string,当前应用程序的名称。 支持
app.setName(name) 覆盖当前应用程序的名称。 支持
app.getLocale() 返回 string,使用 Chromium 的 l10n_util 库获取的当前应用程序语言区域。 支持
app.getLocaleCountryCode() 返回 string,表示用户操作系统语言区域的两字母 ISO 3166 国家代码,从原生 OS AP 支持
app.getSystemLocale() 返回 string,当前系统语言区域。Windows 和 Linux 上使用 Chromium 的 支持
app.getPreferredSystemLanguages() 返回 string[],按优先级从高到低排列的用户首选系统语言列表,适用时包含国家代码。用户可在 W 支持
app.addRecentDocument(path) 将 path 添加到最近文档列表。 支持
app.clearRecentDocuments() 清空最近文档列表。 支持
app.setAsDefaultProtocolClient(protocol[, path, args]) 返回 boolean,表示调用是否成功。将当前应用注册为指定协议(如 electron://)的默认 不支持
app.removeAsDefaultProtocolClient(protocol[, path, args]) 返回 boolean,表示调用是否成功。取消注册当前应用作为指定协议的默认处理程序。 不支持
app.isDefaultProtocolClient(protocol[, path, args]) 返回 boolean,当前可执行文件是否为指定协议的默认处理程序。 不支持
app.getApplicationNameForProtocol(url) 返回 string,处理该协议的应用程序名称,若未找到则返回空字符串。参数接受完整 URL(至少包含 支持
app.getApplicationInfoForProtocol(url) 返回 Promise,resolve 为包含处理该协议的应用程序信息的对象。参数接受 不支持
app.setUserTasks(tasks) 返回 boolean,表示调用是否成功。在 Windows 的跳转列表「任务」分类中添加指定任务。 不支持
app.getJumpListSettings() 返回 Object,包含跳转列表的相关设置信息。 不支持
app.setJumpList(categories) 返回 string,为应用程序设置或移除自定义跳转列表。 不支持
app.requestSingleInstanceLock([additionalData]) 返回 boolean,请求单实例锁,确保应用只运行一个实例。 不支持
app.hasSingleInstanceLock() 返回 boolean,当前应用是否持有单实例锁。 支持
app.releaseSingleInstanceLock() 释放由 requestSingleInstanceLock 创建的所有锁,之后应用将允许多个实例同时 不支持
app.setUserActivity(type, userInfo[, webpageURL]) 创建 NSUserActivity 并设为当前活动,用于支持 Handoff 功能,将活动接力到其他 不支持
app.getCurrentActivityType() 返回 string,当前正在运行的 Handoff 活动类型。 不支持
app.invalidateCurrentActivity() 使当前 Handoff 用户活动失效。 不支持
app.resignCurrentActivity() 将当前 Handoff 用户活动标记为非活跃状态,但不使其失效。 不支持
app.updateCurrentActivity(type, userInfo) 更新当前 NSUserActivity 的活动类型和数据。 不支持
app.setAppUserModelId(id) 将 Application User Model ID 更改为指定的 id。 不支持
app.setActivationPolicy(policy) 设置应用程序的激活策略。 不支持
app.importCertificate(options, callback) 将 pkcs12 格式的证书导入系统证书存储,导入结果通过回调函数返回,0 表示成功,其他值表示失败 不支持
app.configureHostResolver(options) 配置 DNS 解析器,启用时内置解析器将优先于 getaddrinfo,并尝试使用系统 DNS 设置 支持
app.disableHardwareAcceleration() 禁用当前应用程序的硬件加速。 支持
app.disableDomainBlockingFor3DAPIs() 默认情况下,若 GPU 进程频繁崩溃,Chromium 会按域禁用 3D API(如 WebGL)直 支持
app.getAppMetrics() 返回 ProcessMetric[],包含与应用关联的所有进程的内存和 CPU 使用情况统计。 支持
app.getGPUFeatureStatus() 返回 GPUFeatureStatus,即 chrome://gpu/ 中的图形功能状态。 支持
app.getGPUInfo(infoType) 返回 Promise,获取 GPU 相关信息。 支持
app.setBadgeCount([count]) 返回 boolean,表示调用是否成功。设置应用图标的角标数字,设为 0 则隐藏角标。 支持
app.getBadgeCount() 返回 Integer,当前角标显示的数值。 支持
app.isUnityRunning() 返回 boolean,当前桌面环境是否为 Unity 启动器。 不支持
app.getLoginItemSettings([options]) 返回 Object,包含登录项设置信息。若调用时传入了 path 和 args,需传入相同参数以正确 支持
app.setLoginItemSettings(settings) 设置应用程序的登录项配置,可控制是否在系统登录时自动启动应用。 支持
app.isAccessibilitySupportEnabled() 返回 boolean,若 Chrome 的辅助功能支持已启用则返回 true,否则返回 false。 支持
app.setAccessibilitySupportEnabled(enabled) 手动启用或禁用 Chrome 的辅助功能支持,以便在应用设置中向用户开放辅助功能选项。 不支持
app.showAboutPanel() 显示应用程序的「关于」面板,面板内容可通过 app.setAboutPanelOptions() 自 支持
app.setAboutPanelOptions(options) 设置「关于」面板的选项,在 macOS 上会覆盖 .plist 文件中的对应值。 支持
app.isEmojiPanelSupported() 返回 boolean,当前操作系统版本是否支持原生 emoji 选择器。 支持
app.showEmojiPanel() 显示系统原生 emoji 选择器面板。 不支持
app.startAccessingSecurityScopedResource(bookmarkData) 返回 Function,访问沙盒外的安全范围文件时使用。完成访问后必须调用返回的函数,否则会泄漏内核 不支持
app.enableSandbox() 为应用启用完全沙盒模式,所有渲染进程都将在沙盒中运行,忽略 WebPreferences 中的 sa 支持
app.isInApplicationsFolder() 返回 boolean,应用程序当前是否在 Applications 文件夹中运行。 不支持
app.moveToApplicationsFolder([options]) 返回 boolean,表示移动是否成功,将应用移动到 Applications 文件夹。 不支持
app.isSecureKeyboardEntryEnabled() 返回 boolean,安全键盘输入是否已启用。 不支持
app.setSecureKeyboardEntryEnabled(enabled) 设置是否在应用程序中启用安全键盘输入。 不支持
app.setProxy(config) 返回 Promise,代理设置完成后 resolve。 支持
app.resolveProxy(url) 返回 Promise,resolve 为工具进程使用 Net 发起请求时,指定 UR 支持
app.setClientCertRequestPasswordHandler(handler) 返回 Promise,resolve 为客户端证书密码。 不支持
app.getDeviceInfo() 查询设备信息,目前仅支持设备模式(pc模式/pad普通模式/pad自由多窗 支持

Properties(属性)

API 说明 鸿蒙支持
app.accessibilitySupportEnabled boolean 属性,若 Chrome 的辅助功能支持已启用则为 true,否则为 false。当检 支持
app.applicationMenu Menu null 属性,若已设置菜单则返回 Menu,否则返回 null。可通过赋值来设置应用
app.badgeCount Integer 属性,当前应用角标显示的数值,设为 0 时隐藏角标。 支持
app.commandLine CommandLine 对象,用于读取和操作 Chromium 使用的命令行参数。 支持
app.dock Dock undefined 对象,用于在 macOS 上操作应用在用户 Dock 中的图标。
app.isPackaged boolean 属性,若应用已打包则为 true,否则为 false,可用于区分开发环境和生产环境。 支持
app.name string 属性,表示当前应用程序的名称,即 package.json 中的 name 字段。 支持
app.userAgentFallback string 属性,Electron 作为全局回退使用的 User-Agent 字符串。 支持
app.runningUnderARM64Translation boolean 属性,为 true 时表示应用当前在 ARM64 转译器下运行(如 macOS Ro 支持