electron

package module
v0.0.0-...-699f2aa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2017 License: MIT Imports: 2 Imported by: 1

README

Gopherjs Electron

This project implements an API translator and some convenience functions for creating Electron APP using Gopherjs.

Usage

go get github.com/oskca/gopherjs-electron
go generate # calling the API translator 

API Translator

The translator reads electron api json file and output the corresponding gopherjs struct and functions into files with raw_ prefix.

The translator lives in directory: json2rawApi.

Easy binding functions

Hand written binding functions/struct lives in ex_*.go files and have Ex postfix.

Documentation

Overview

Package electron implements an API translator and some convenience functions for creating Electron APP using Gopherjs.

Usage

go get github.com/oskca/gopherjs-electron go generate # calling the API translator

API Translator

The translator reads electron api json file and output the corresponding gopherjs struct and functions into files with raw_ prefix.

Easy binding functions

Hand written binding functions/struct lives in ex_*.go files and have Ex postfix.

Index

Constants

View Source
const (
	DialogPropOpenFile        = "openFile"
	DialogPropOpenDirectory   = "openDirectory"
	DialogPropMultiSelections = "multiSelections"
	DialogPropCreateDirectory = "createDirectory"
	DialogPropShowHiddenFiles = "showHiddenFiles"
)

OpenDialog properties

View Source
const (
	DialogTypeNone     = "none"
	DialogTypeInfo     = "info"
	DialogTypeError    = "error"
	DialogTypeQuestion = "question"
	DialogTypeWarning  = "warning"
)

const for Message Type

View Source
const (
	RoleUndo               = "undo"
	RoleRedo               = "redo"
	RoleCut                = "cut"
	RoleCopy               = "copy"
	RolePaste              = "paste"
	RolePasteandmatchstyle = "pasteandmatchstyle"
	RoleSelectall          = "selectall"
	RoleDelete             = "delete"
	// minimize - Minimize current window
	RoleMinimize = "minimize"
	// close - Close current window
	RoleClose = "close"
	// quit- Quit the application
	RoleQuit = "quit-"
	// reload - Reload the current window
	RoleReload = "reload"
	// toggledevtools - Toggle developer tools in the current window
	RoleToggledevtools = "toggledevtools"
	// togglefullscreen- Toggle full screen mode on the current window
	RoleTogglefullscreen = "togglefullscreen-"
	// resetzoom - Reset the focused page’s zoom level to the original size
	RoleResetzoom = "resetzoom"
	// zoomin - Zoom in the focused page by 10%
	RoleZoomin = "zoomin"
	// zoomout - Zoom out the focused page by 10%
	RoleZoomout = "zoomout"

	// On macOS role can also have following additional values:
	// When specifying role on macOS, label and accelerator are the only options that
	// will affect the MenuItem. All other options will be ignored.
	RoleCOS = "cOS"
	// about - Map to the orderFrontStandardAboutPanel action
	RoleAbout = "about"
	// hide - Map to the hide action
	RoleHide = "hide"
	// hideothers - Map to the hideOtherApplications action
	RoleHideothers = "hideothers"
	// unhide - Map to the unhideAllApplications action
	RoleUnhide = "unhide"
	// startspeaking - Map to the startSpeaking action
	RoleStartspeaking = "startspeaking"
	// stopspeaking - Map to the stopSpeaking action
	RoleStopspeaking = "stopspeaking"
	// front - Map to the arrangeInFront action
	RoleFront = "front"
	// zoom - Map to the performZoom action
	RoleZoom = "zoom"
	// window - The submenu is a “Window” menu
	RoleWindow = "window"
	// help - The submenu is a “Help” menu
	RoleHelp = "help"
	// services - The submenu is a “Services” menu
	RoleServices = "services "
)

MenuItem roles

View Source
const (
	// Emitted when the application has finished basic startup. On Windows and Linux, the will-finish-launching event is the same as the ready event; on macOS, this event represents the applicationWillFinishLaunching notification of NSApplication. You would usually set up listeners for the open-file and open-url events here, and start the crash reporter and auto updater. In most cases, you should just do everything in the ready event handler.
	EvtAppWillFinishLaunching = "will-finish-launching"
	// Emitted when Electron has finished initializing. On macOS, launchInfo holds the userInfo of the NSUserNotification that was used to open the application, if it was launched from Notification Center. You can call app.isReady() to check if this event has already fired.
	EvtAppReady = "ready"
	// Emitted when all windows have been closed. If you do not subscribe to this event and all windows are closed, the default behavior is to quit the app; however, if you subscribe, you control whether the app quits or not. If the user pressed Cmd + Q, or the developer called app.quit(), Electron will first try to close all the windows and then emit the will-quit event, and in this case the window-all-closed event would not be emitted.
	EvtAppWindowAllClosed = "window-all-closed"
	// Emitted before the application starts closing its windows. Calling event.preventDefault() will prevent the default behaviour, which is terminating the application. Note: If application quit was initiated by autoUpdater.quitAndInstall() then before-quit is emitted after emitting close event on all windows and closing them.
	EvtAppBeforeQuit = "before-quit"
	// Emitted when all windows have been closed and the application will quit. Calling event.preventDefault() will prevent the default behaviour, which is terminating the application. See the description of the window-all-closed event for the differences between the will-quit and window-all-closed events.
	EvtAppWillQuit = "will-quit"
	// Emitted when the application is quitting.
	EvtAppQuit = "quit"
	// Emitted when the user wants to open a file with the application. The open-file event is usually emitted when the application is already open and the OS wants to reuse the application to open the file. open-file is also emitted when a file is dropped onto the dock and the application is not yet running. Make sure to listen for the open-file event very early in your application startup to handle this case (even before the ready event is emitted). You should call event.preventDefault() if you want to handle this event. On Windows, you have to parse process.argv (in the main process) to get the filepath.
	EvtAppOpenFile = "open-file"
	// Emitted when the user wants to open a URL with the application. Your application's Info.plist file must define the url scheme within the CFBundleURLTypes key, and set NSPrincipalClass to AtomApplication. You should call event.preventDefault() if you want to handle this event.
	EvtAppOpenURL = "open-url"
	// Emitted when the application is activated, which usually happens when the user clicks on the application's dock icon.
	EvtAppActivate = "activate"
	// Emitted during Handoff when an activity from a different device wants to be resumed. You should call event.preventDefault() if you want to handle this event. A user activity can be continued only in an app that has the same developer Team ID as the activity's source app and that supports the activity's type. Supported activity types are specified in the app's Info.plist under the NSUserActivityTypes key.
	EvtAppContinueActivity = "continue-activity"
	// Emitted when a browserWindow gets blurred.
	EvtAppBrowserWindowBlur = "browser-window-blur"
	// Emitted when a browserWindow gets focused.
	EvtAppBrowserWindowFocus = "browser-window-focus"
	// Emitted when a new browserWindow is created.
	EvtAppBrowserWindowCreated = "browser-window-created"
	// Emitted when a new webContents is created.
	EvtAppWebContentsCreated = "web-contents-created"
	// Emitted when failed to verify the certificate for url, to trust the certificate you should prevent the default behavior with event.preventDefault() and call callback(true).
	EvtAppCertificateError = "certificate-error"
	// Emitted when a client certificate is requested. The url corresponds to the navigation entry requesting the client certificate and callback can be called with an entry filtered from the list. Using event.preventDefault() prevents the application from using the first certificate from the store.
	EvtAppSelectClientCertificate = "select-client-certificate"
	// Emitted when webContents wants to do basic auth. The default behavior is to cancel all authentications, to override this you should prevent the default behavior with event.preventDefault() and call callback(username, password) with the credentials.
	EvtAppLogin = "login"
	// Emitted when the gpu process crashes or is killed.
	EvtAppGpuProcessCrashed = "gpu-process-crashed"
	// Emitted when Chrome's accessibility support changes. This event fires when assistive technologies, such as screen readers, are enabled or disabled. See https://www.chromium.org/developers/design-documents/accessibility for more details.
	EvtAppAccessibilitySupportChanged = "accessibility-support-changed"
)
View Source
const (
	// Emitted when there is an error while updating.
	EvtAutoUpdaterError = "error"
	// Emitted when checking if an update has started.
	EvtAutoUpdaterCheckingForUpdate = "checking-for-update"
	// Emitted when there is an available update. The update is downloaded automatically.
	EvtAutoUpdaterUpdateAvailable = "update-available"
	// Emitted when there is no available update.
	EvtAutoUpdaterUpdateNotAvailable = "update-not-available"
	// Emitted when an update has been downloaded. On Windows only releaseName is available.
	EvtAutoUpdaterUpdateDownloaded = "update-downloaded"
)
View Source
const (
	// Emitted when the document changed its title, calling event.preventDefault() will prevent the native window's title from changing.
	EvtBrowserWindowPageTitleUpdated = "page-title-updated"
	// Emitted when the window is going to be closed. It's emitted before the beforeunload and unload event of the DOM. Calling event.preventDefault() will cancel the close. Usually you would want to use the beforeunload handler to decide whether the window should be closed, which will also be called when the window is reloaded. In Electron, returning any value other than undefined would cancel the close. For example:
	EvtBrowserWindowClose = "close"
	// Emitted when the window is closed. After you have received this event you should remove the reference to the window and avoid using it any more.
	EvtBrowserWindowClosed = "closed"
	// Emitted when the web page becomes unresponsive.
	EvtBrowserWindowUnresponsive = "unresponsive"
	// Emitted when the unresponsive web page becomes responsive again.
	EvtBrowserWindowResponsive = "responsive"
	// Emitted when the window loses focus.
	EvtBrowserWindowBlur = "blur"
	// Emitted when the window gains focus.
	EvtBrowserWindowFocus = "focus"
	// Emitted when the window is shown.
	EvtBrowserWindowShow = "show"
	// Emitted when the window is hidden.
	EvtBrowserWindowHide = "hide"
	// Emitted when the web page has been rendered and window can be displayed without a visual flash.
	EvtBrowserWindowReadyToShow = "ready-to-show"
	// Emitted when window is maximized.
	EvtBrowserWindowMaximize = "maximize"
	// Emitted when the window exits from a maximized state.
	EvtBrowserWindowUnmaximize = "unmaximize"
	// Emitted when the window is minimized.
	EvtBrowserWindowMinimize = "minimize"
	// Emitted when the window is restored from a minimized state.
	EvtBrowserWindowRestore = "restore"
	// Emitted when the window is being resized.
	EvtBrowserWindowResize = "resize"
	// Emitted when the window is being moved to a new position. Note: On macOS this event is just an alias of moved.
	EvtBrowserWindowMove = "move"
	// Emitted once when the window is moved to a new position.
	EvtBrowserWindowMoved = "moved"
	// Emitted when the window enters a full-screen state.
	EvtBrowserWindowEnterFullScreen = "enter-full-screen"
	// Emitted when the window leaves a full-screen state.
	EvtBrowserWindowLeaveFullScreen = "leave-full-screen"
	// Emitted when the window enters a full-screen state triggered by HTML API.
	EvtBrowserWindowEnterHtmlFullScreen = "enter-html-full-screen"
	// Emitted when the window leaves a full-screen state triggered by HTML API.
	EvtBrowserWindowLeaveHtmlFullScreen = "leave-html-full-screen"
	// Emitted when an App Command is invoked. These are typically related to keyboard media keys or browser commands, as well as the "Back" button built into some mice on Windows. Commands are lowercased, underscores are replaced with hyphens, and the APPCOMMAND_ prefix is stripped off. e.g. APPCOMMAND_BROWSER_BACKWARD is emitted as browser-backward.
	EvtBrowserWindowAppCommand = "app-command"
	// Emitted when scroll wheel event phase has begun.
	EvtBrowserWindowScrollTouchBegin = "scroll-touch-begin"
	// Emitted when scroll wheel event phase has ended.
	EvtBrowserWindowScrollTouchEnd = "scroll-touch-end"
	// Emitted when scroll wheel event phase filed upon reaching the edge of element.
	EvtBrowserWindowScrollTouchEdge = "scroll-touch-edge"
	// Emitted on 3-finger swipe. Possible directions are up, right, down, left.
	EvtBrowserWindowSwipe = "swipe"
)

events

View Source
const (
	EvtClientRequestResponse = "response"
	// Emitted when an authenticating proxy is asking for user credentials. The callback function is expected to be called back with user credentials: Providing empty credentials will cancel the request and report an authentication error on the response object:
	EvtClientRequestLogin = "login"
	// Emitted just after the last chunk of the request's data has been written into the request object.
	EvtClientRequestFinish = "finish"
	// Emitted when the request is aborted. The abort event will not be fired if the request is already closed.
	EvtClientRequestAbort = "abort"
	// Emitted when the net module fails to issue a network request. Typically when the request object emits an error event, a close event will subsequently follow and no response object will be provided.
	EvtClientRequestError = "error"
	// Emitted as the last event in the HTTP request-response transaction. The close event indicates that no more events will be emitted on either the request or response objects.
	EvtClientRequestClose = "close"
)

events

View Source
const (
	// Emitted when debugging session is terminated. This happens either when webContents is closed or devtools is invoked for the attached webContents.
	EvtDebuggerDetach = "detach"
	// Emitted whenever debugging target issues instrumentation event.
	EvtDebuggerMessage = "message"
)

events

View Source
const (
	// Emitted when the download has been updated and is not done. The state can be one of following:
	EvtDownloadItemUpdated = "updated"
	// Emitted when the download is in a terminal state. This includes a completed download, a cancelled download (via downloadItem.cancel()), and interrupted download that can't be resumed. The state can be one of following:
	EvtDownloadItemDone = "done"
)

events

View Source
const (
	// The data event is the usual method of transferring response data into applicative code.
	EvtIncomingMessageData = "data"
	// Indicates that response body has ended.
	EvtIncomingMessageEnd = "end"
	// Emitted when a request has been canceled during an ongoing HTTP transaction.
	EvtIncomingMessageAborted = "aborted"
	// error Error - Typically holds an error string identifying failure root cause. Emitted when an error was encountered while streaming response data events. For instance, if the server closes the underlying while the response is still streaming, an error event will be emitted on the response object and a close event will subsequently follow on the request object.
	EvtIncomingMessageError = "error"
)

events

View Source
const (
	// Emitted when the system is suspending.
	EvtPowerMonitorSuspend = "suspend"
	// Emitted when system is resuming.
	EvtPowerMonitorResume = "resume"
	// Emitted when the system changes to AC power.
	EvtPowerMonitorOnAc = "on-ac"
	// Emitted when system changes to battery power.
	EvtPowerMonitorOnBattery = "on-battery"
)
View Source
const (
	// Emitted when newDisplay has been added.
	EvtScreenDisplayAdded = "display-added"
	// Emitted when oldDisplay has been removed.
	EvtScreenDisplayRemoved = "display-removed"
	// Emitted when one or more metrics change in a display. The changedMetrics is an array of strings that describe the changes. Possible changes are bounds, workArea, scaleFactor and rotation.
	EvtScreenDisplayMetricsChanged = "display-metrics-changed"
)
View Source
const (
	EvtSystemPreferencesAccentColorChanged         = "accent-color-changed"
	EvtSystemPreferencesColorChanged               = "color-changed"
	EvtSystemPreferencesInvertedColorSchemeChanged = "inverted-color-scheme-changed"
)
View Source
const (
	// Emitted when the tray icon is clicked.
	EvtTrayClick = "click"
	// Emitted when the tray icon is right clicked.
	EvtTrayRightClick = "right-click"
	// Emitted when the tray icon is double clicked.
	EvtTrayDoubleClick = "double-click"
	// Emitted when the tray balloon shows.
	EvtTrayBalloonShow = "balloon-show"
	// Emitted when the tray balloon is clicked.
	EvtTrayBalloonClick = "balloon-click"
	// Emitted when the tray balloon is closed because of timeout or user manually closes it.
	EvtTrayBalloonClosed = "balloon-closed"
	// Emitted when any dragged items are dropped on the tray icon.
	EvtTrayDrop = "drop"
	// Emitted when dragged files are dropped in the tray icon.
	EvtTrayDropFiles = "drop-files"
	// Emitted when dragged text is dropped in the tray icon.
	EvtTrayDropText = "drop-text"
	// Emitted when a drag operation enters the tray icon.
	EvtTrayDragEnter = "drag-enter"
	// Emitted when a drag operation exits the tray icon.
	EvtTrayDragLeave = "drag-leave"
	// Emitted when a drag operation ends on the tray or ends at another location.
	EvtTrayDragEnd = "drag-end"
)

events

View Source
const (
	// Emitted when the navigation is done, i.e. the spinner of the tab has stopped spinning, and the onload event was dispatched.
	EvtWebContentsDidFinishLoad = "did-finish-load"
	// This event is like did-finish-load but emitted when the load failed or was cancelled, e.g. window.stop() is invoked. The full list of error codes and their meaning is available here. Note that redirect responses will emit errorCode -3; you may want to ignore that error explicitly.
	EvtWebContentsDidFailLoad = "did-fail-load"
	// Emitted when a frame has done navigation.
	EvtWebContentsDidFrameFinishLoad = "did-frame-finish-load"
	// Corresponds to the points in time when the spinner of the tab started spinning.
	EvtWebContentsDidStartLoading = "did-start-loading"
	// Corresponds to the points in time when the spinner of the tab stopped spinning.
	EvtWebContentsDidStopLoading = "did-stop-loading"
	// Emitted when details regarding a requested resource are available. status indicates the socket connection to download the resource.
	EvtWebContentsDidGetResponseDetails = "did-get-response-details"
	// Emitted when a redirect is received while requesting a resource.
	EvtWebContentsDidGetRedirectRequest = "did-get-redirect-request"
	// Emitted when the document in the given frame is loaded.
	EvtWebContentsDomReady = "dom-ready"
	// Emitted when page receives favicon urls.
	EvtWebContentsPageFaviconUpdated = "page-favicon-updated"
	// Emitted when the page requests to open a new window for a url. It could be requested by window.open or an external link like . By default a new BrowserWindow will be created for the url. Calling event.preventDefault() will prevent creating new windows. In such case, the event.newGuest may be set with a reference to a BrowserWindow instance to make it used by the Electron's runtime.
	EvtWebContentsNewWindow = "new-window"
	// Emitted when a user or the page wants to start navigation. It can happen when the window.location object is changed or a user clicks a link in the page. This event will not emit when the navigation is started programmatically with APIs like webContents.loadURL and webContents.back. It is also not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose. Calling event.preventDefault() will prevent the navigation.
	EvtWebContentsWillNavigate = "will-navigate"
	// Emitted when a navigation is done. This event is not emitted for in-page navigations, such as clicking anchor links or updating the window.location.hash. Use did-navigate-in-page event for this purpose.
	EvtWebContentsDidNavigate = "did-navigate"
	// Emitted when an in-page navigation happened. When in-page navigation happens, the page URL changes but does not cause navigation outside of the page. Examples of this occurring are when anchor links are clicked or when the DOM hashchange event is triggered.
	EvtWebContentsDidNavigateInPage = "did-navigate-in-page"
	// Emitted when the renderer process crashes or is killed.
	EvtWebContentsCrashed = "crashed"
	// Emitted when a plugin process has crashed.
	EvtWebContentsPluginCrashed = "plugin-crashed"
	// Emitted when webContents is destroyed.
	EvtWebContentsDestroyed = "destroyed"
	// Emitted before dispatching the keydown and keyup events in the page. Calling event.preventDefault will prevent the page keydown/keyup events from being dispatched.
	EvtWebContentsBeforeInputEvent = "before-input-event"
	// Emitted when DevTools is opened.
	EvtWebContentsDevtoolsOpened = "devtools-opened"
	// Emitted when DevTools is closed.
	EvtWebContentsDevtoolsClosed = "devtools-closed"
	// Emitted when DevTools is focused / opened.
	EvtWebContentsDevtoolsFocused = "devtools-focused"
	// Emitted when failed to verify the certificate for url. The usage is the same with the certificate-error event of app.
	EvtWebContentsCertificateError = "certificate-error"
	// Emitted when a client certificate is requested. The usage is the same with the select-client-certificate event of app.
	EvtWebContentsSelectClientCertificate = "select-client-certificate"
	// Emitted when webContents wants to do basic auth. The usage is the same with the login event of app.
	EvtWebContentsLogin = "login"
	// Emitted when a result is available for [webContents.findInPage] request.
	EvtWebContentsFoundInPage = "found-in-page"
	// Emitted when media starts playing.
	EvtWebContentsMediaStartedPlaying = "media-started-playing"
	// Emitted when media is paused or done playing.
	EvtWebContentsMediaPaused = "media-paused"
	// Emitted when a page's theme color changes. This is usually due to encountering a meta tag:
	EvtWebContentsDidChangeThemeColor = "did-change-theme-color"
	// Emitted when mouse moves over a link or the keyboard moves the focus to a link.
	EvtWebContentsUpdateTargetURL = "update-target-url"
	// Emitted when the cursor's type changes. The type parameter can be default, crosshair, pointer, text, wait, help, e-resize, n-resize, ne-resize, nw-resize, s-resize, se-resize, sw-resize, w-resize, ns-resize, ew-resize, nesw-resize, nwse-resize, col-resize, row-resize, m-panning, e-panning, n-panning, ne-panning, nw-panning, s-panning, se-panning, sw-panning, w-panning, move, vertical-text, cell, context-menu, alias, progress, nodrop, copy, none, not-allowed, zoom-in, zoom-out, grab, grabbing, custom. If the type parameter is custom, the image parameter will hold the custom cursor image in a NativeImage, and scale, size and hotspot will hold additional information about the custom cursor.
	EvtWebContentsCursorChanged = "cursor-changed"
	// Emitted when there is a new context menu that needs to be handled.
	EvtWebContentsContextMenu = "context-menu"
	// Emitted when bluetooth device needs to be selected on call to navigator.bluetooth.requestDevice. To use navigator.bluetooth api webBluetooth should be enabled.  If event.preventDefault is not called, first available device will be selected. callback should be called with deviceId to be selected, passing empty string to callback will cancel the request.
	EvtWebContentsSelectBluetoothDevice = "select-bluetooth-device"
	// Emitted when a new frame is generated. Only the dirty area is passed in the buffer.
	EvtWebContentsPaint = "paint"
	// Emitted when the devtools window instructs the webContents to reload
	EvtWebContentsDevtoolsReloadPage = "devtools-reload-page"
)

events

View Source
const (
	// Emitted when a cookie is changed because it was added, edited, removed, or expired.
	EvtCookiesChanged = "changed"
)

events

View Source
const (
	// Emitted when Electron has loaded its internal initialization script and is beginning to load the web page or the main script. It can be used by the preload script to add removed Node global symbols back to the global scope when node integration is turned off:
	EvtProcessLoaded = "loaded"
)
View Source
const (
	// Emitted when Electron is about to download item in webContents. Calling event.preventDefault() will cancel the download and item will not be available from next tick of the process.
	EvtSessionWillDownload = "will-download"
)

events

Variables

This section is empty.

Functions

func AddDevToolsExtension

func AddDevToolsExtension(Path string)

func BuildFromTemplate

func BuildFromTemplate(Template *js.Object) *js.Object

func FromId

func FromId(Id int64) *js.Object

func FromWebContents

func FromWebContents(WebContents *WebContents) *js.Object

func Get

func Get(name string) *js.Object

Get returns a electron or `electron.remote` module

func GetAllWindows

func GetAllWindows() *js.Object

func GetApplicationMenu

func GetApplicationMenu() *js.Object

func GetDevToolsExtensions

func GetDevToolsExtensions() *js.Object

func GetFocusedWindow

func GetFocusedWindow() *js.Object

func RemoveDevToolsExtension

func RemoveDevToolsExtension(Name string)

func SendActionToFirstResponder

func SendActionToFirstResponder(Action string)

func SetApplicationMenu

func SetApplicationMenu(Menu *Menu)

func UseRemote

func UseRemote()

UseRemote switch `electron.Get` to get module through `electron.remote` this functon must be call when use electron.remote in render process

Types

type AppModule

type AppModule struct {
	*events.Emitter
	CommandLine *AppModuleAppModuleCommandLine `js:"commandLine"`
	Dock        *AppModuleAppModuleDock        `js:"dock"`
	// Try to close all windows. The before-quit event will be emitted first. If all windows are successfully closed, the will-quit event will be emitted and by default the application will terminate. This method guarantees that all beforeunload and unload event handlers are correctly executed. It is possible that a window cancels the quitting by returning false in the beforeunload event handler.
	Quit func() `js:"quit"`
	// Exits immediately with exitCode.  exitCode defaults to 0. All windows will be closed immediately without asking user and the before-quit and will-quit events will not be emitted.
	Exit func(ExitCode int64) `js:"exit"`
	// Relaunches the app when current instance exits. By default the new instance will use the same working directory and command line arguments with current instance. When args is specified, the args will be passed as command line arguments instead. When execPath is specified, the execPath will be executed for relaunch instead of current app. Note that this method does not quit the app when executed, you have to call app.quit or app.exit after calling app.relaunch to make the app restart. When app.relaunch is called for multiple times, multiple instances will be started after current instance exited. An example of restarting current instance immediately and adding a new command line argument to the new instance:
	Relaunch func(Options *AppModuleRelaunchOptions) `js:"relaunch"`
	IsReady  func() (Obj bool)                       `js:"isReady"`
	// On Linux, focuses on the first visible window. On macOS, makes the application the active app. On Windows, focuses on the application's first window.
	Focus func() `js:"focus"`
	// Hides all application windows without minimizing them.
	Hide func() `js:"hide"`
	// Shows application windows after they were hidden. Does not automatically focus them.
	Show       func()              `js:"show"`
	GetAppPath func() (Obj string) `js:"getAppPath"`
	// You can request the following paths by the name:
	GetPath func(Name string) (Obj string) `js:"getPath"`
	// Overrides the path to a special directory or file associated with name. If the path specifies a directory that does not exist, the directory will be created by this method. On failure an Error is thrown. You can only override paths of a name defined in app.getPath. By default, web pages' cookies and caches will be stored under the userData directory. If you want to change this location, you have to override the userData path before the ready event of the app module is emitted.
	SetPath    func(Name string, Path string) `js:"setPath"`
	GetVersion func() (Obj string)            `js:"getVersion"`
	// Usually the name field of package.json is a short lowercased name, according to the npm modules spec. You should usually also specify a productName field, which is your application's full capitalized name, and which will be preferred over name by Electron.
	GetName func() (Obj string) `js:"getName"`
	// Overrides the current application's name.
	SetName func(Name string) `js:"setName"`
	// Note: When distributing your packaged app, you have to also ship the locales folder. Note: On Windows you have to call it after the ready events gets emitted.
	GetLocale func() (Obj string) `js:"getLocale"`
	// Adds path to the recent documents list. This list is managed by the OS. On Windows you can visit the list from the task bar, and on macOS you can visit it from dock menu.
	AddRecentDocument func(Path string) `js:"addRecentDocument"`
	// Clears the recent documents list.
	ClearRecentDocuments func() `js:"clearRecentDocuments"`
	// This method sets the current executable as the default handler for a protocol (aka URI scheme). It allows you to integrate your app deeper into the operating system. Once registered, all links with your-protocol:// will be opened with the current executable. The whole link, including protocol, will be passed to your application as a parameter. On Windows you can provide optional parameters path, the path to your executable, and args, an array of arguments to be passed to your executable when it launches. Note: On macOS, you can only register protocols that have been added to your app's info.plist, which can not be modified at runtime. You can however change the file with a simple text editor or script during build time. Please refer to Apple's documentation for details. The API uses the Windows Registry and LSSetDefaultHandlerForURLScheme internally.
	SetAsDefaultProtocolClient func(Protocol string, Path string, Args *js.Object) (Obj bool) `js:"setAsDefaultProtocolClient"`
	// This method checks if the current executable as the default handler for a protocol (aka URI scheme). If so, it will remove the app as the default handler.
	RemoveAsDefaultProtocolClient func(Protocol string, Path string, Args *js.Object) (Obj bool) `js:"removeAsDefaultProtocolClient"`
	// This method checks if the current executable is the default handler for a protocol (aka URI scheme). If so, it will return true. Otherwise, it will return false. Note: On macOS, you can use this method to check if the app has been registered as the default protocol handler for a protocol. You can also verify this by checking ~/Library/Preferences/com.apple.LaunchServices.plist on the macOS machine. Please refer to Apple's documentation for details. The API uses the Windows Registry and LSCopyDefaultHandlerForURLScheme internally.
	IsDefaultProtocolClient func(Protocol string, Path string, Args *js.Object) (Obj bool) `js:"isDefaultProtocolClient"`
	// Adds tasks to the Tasks category of the JumpList on Windows. tasks is an array of Task objects. Note: If you'd like to customize the Jump List even more use app.setJumpList(categories) instead.
	SetUserTasks        func(Tasks *js.Object) (Obj bool)             `js:"setUserTasks"`
	GetJumpListSettings func() (Obj *AppModuleGetJumpListSettingsObj) `js:"getJumpListSettings"`
	// Sets or removes a custom Jump List for the application, and returns one of the following strings: If categories is null the previously set custom Jump List (if any) will be replaced by the standard Jump List for the app (managed by Windows). Note: If a JumpListCategory object has neither the type nor the name property set then its type is assumed to be tasks. If the name property is set but the type property is omitted then the type is assumed to be custom. Note: Users can remove items from custom categories, and Windows will not allow a removed item to be added back into a custom category until after the next successful call to app.setJumpList(categories). Any attempt to re-add a removed item to a custom category earlier than that will result in the entire custom category being omitted from the Jump List. The list of removed items can be obtained using app.getJumpListSettings(). Here's a very simple example of creating a custom Jump List:
	SetJumpList func(Categories *js.Object) `js:"setJumpList"`
	// This method makes your application a Single Instance Application - instead of allowing multiple instances of your app to run, this will ensure that only a single instance of your app is running, and other instances signal this instance and exit. callback will be called with callback(argv, workingDirectory) when a second instance has been executed. argv is an Array of the second instance's command line arguments, and workingDirectory is its current working directory. Usually applications respond to this by making their primary window focused and non-minimized. The callback is guaranteed to be executed after the ready event of app gets emitted. This method returns false if your process is the primary instance of the application and your app should continue loading. And returns true if your process has sent its parameters to another instance, and you should immediately quit. On macOS the system enforces single instance automatically when users try to open a second instance of your app in Finder, and the open-file and open-url events will be emitted for that. However when users start your app in command line the system's single instance mechanism will be bypassed and you have to use this method to ensure single instance. An example of activating the window of primary instance when a second instance starts:
	MakeSingleInstance func(Callback AppModuleMakeSingleInstanceCallback) `js:"makeSingleInstance"`
	// Releases all locks that were created by makeSingleInstance. This will allow multiple instances of the application to once again run side by side.
	ReleaseSingleInstance func() `js:"releaseSingleInstance"`
	// Creates an NSUserActivity and sets it as the current activity. The activity is eligible for Handoff to another device afterward.
	SetUserActivity        func(Type string, UserInfo *AppModuleSetUserActivityUserInfo, WebpageURL string) `js:"setUserActivity"`
	GetCurrentActivityType func() (Obj string)                                                              `js:"getCurrentActivityType"`
	// Changes the Application User Model ID to id.
	SetAppUserModelId func(Id string) `js:"setAppUserModelId"`
	// Imports the certificate in pkcs12 format into the platform certificate store. callback is called with the result of import operation, a value of 0 indicates success while any other value indicates failure according to chromium net_error_list.
	ImportCertificate func(Options *AppModuleImportCertificateOptions, Callback AppModuleImportCertificateCallback) `js:"importCertificate"`
	// Disables hardware acceleration for current app. This method can only be called before app is ready.
	DisableHardwareAcceleration func() `js:"disableHardwareAcceleration"`
	// Sets the counter badge for current app. Setting the count to 0 will hide the badge. On macOS it shows on the dock icon. On Linux it only works for Unity launcher, Note: Unity launcher requires the exsistence of a .desktop file to work, for more information please read Desktop Environment Integration.
	SetBadgeCount  func(Count int64) (Obj bool) `js:"setBadgeCount"`
	GetBadgeCount  func() (Obj int64)           `js:"getBadgeCount"`
	IsUnityRunning func() (Obj bool)            `js:"isUnityRunning"`
	// Note: This API has no effect on MAS builds.
	GetLoginItemSettings func() (Obj *AppModuleGetLoginItemSettingsObj) `js:"getLoginItemSettings"`
	// Set the app's login item settings. Note: This API has no effect on MAS builds.
	SetLoginItemSettings          func(Settings *AppModuleSetLoginItemSettingsSettings) `js:"setLoginItemSettings"`
	IsAccessibilitySupportEnabled func() (Obj bool)                                     `js:"isAccessibilitySupportEnabled"`
	// Set the about panel options. This will override the values defined in the app's .plist file. See the Apple docs for more details.
	SetAboutPanelOptions func(Options *AppModuleSetAboutPanelOptionsOptions) `js:"setAboutPanelOptions"`
}

AppModule version@1.4.15

Control your application's event lifecycle.

func GetApp

func GetApp() *AppModule

func GetAppModule

func GetAppModule() *AppModule

type AppModuleAppModuleCommandLine

type AppModuleAppModuleCommandLine struct {
	*js.Object
	// Append a switch (with optional value) to Chromium's command line. Note: This will not affect process.argv, and is mainly used by developers to control some low-level Chromium behaviors.
	AppendSwitch AppModuleCommandLineAppendSwitch `js:"appendSwitch"`
	// Append an argument to Chromium's command line. The argument will be quoted correctly. Note: This will not affect process.argv.
	AppendArgument AppModuleCommandLineAppendArgument `js:"appendArgument"`
}

type AppModuleAppModuleDock

type AppModuleAppModuleDock struct {
	*js.Object
	// When critical is passed, the dock icon will bounce until either the application becomes active or the request is canceled. When informational is passed, the dock icon will bounce for one second. However, the request remains active until either the application becomes active or the request is canceled.
	Bounce AppModuleDockBounce `js:"bounce"`
	// Cancel the bounce of id.
	CancelBounce AppModuleDockCancelBounce `js:"cancelBounce"`
	// Bounces the Downloads stack if the filePath is inside the Downloads folder.
	DownloadFinished AppModuleDockDownloadFinished `js:"downloadFinished"`
	// Sets the string to be displayed in the dock’s badging area.
	SetBadge AppModuleDockSetBadge `js:"setBadge"`
	GetBadge AppModuleDockGetBadge `js:"getBadge"`
	// Hides the dock icon.
	Hide AppModuleDockHide `js:"hide"`
	// Shows the dock icon.
	Show      AppModuleDockShow      `js:"show"`
	IsVisible AppModuleDockIsVisible `js:"isVisible"`
	// Sets the application's dock menu.
	SetMenu AppModuleDockSetMenu `js:"setMenu"`
	// Sets the image associated with this dock icon.
	SetIcon AppModuleDockSetIcon `js:"setIcon"`
}

type AppModuleBounceType

type AppModuleBounceType string
const (
	AppModuleBounceTypeCritical      AppModuleBounceType = "critical"
	AppModuleBounceTypeInformational AppModuleBounceType = "informational"
)

consts

type AppModuleCommandLineAppendArgument

type AppModuleCommandLineAppendArgument func(
	Value string)

type AppModuleCommandLineAppendSwitch

type AppModuleCommandLineAppendSwitch func(
	Switch string,
	Value string)

type AppModuleDockBounce

type AppModuleDockBounce func(
	Type AppModuleBounceType)

type AppModuleDockCancelBounce

type AppModuleDockCancelBounce func(Id int64)

type AppModuleDockDownloadFinished

type AppModuleDockDownloadFinished func(FilePath string)

type AppModuleDockGetBadge

type AppModuleDockGetBadge func()

type AppModuleDockHide

type AppModuleDockHide func()

type AppModuleDockIsVisible

type AppModuleDockIsVisible func()

type AppModuleDockSetBadge

type AppModuleDockSetBadge func(Text string)

type AppModuleDockSetIcon

type AppModuleDockSetIcon func(Image *NativeImage)

type AppModuleDockSetMenu

type AppModuleDockSetMenu func(Menu *Menu)

type AppModuleDockShow

type AppModuleDockShow func()

type AppModuleGetJumpListSettingsObj

type AppModuleGetJumpListSettingsObj struct {
	*js.Object
	// The minimum number of items that will be shown in the Jump List (for a more detailed description of this value see the ).
	MinItems int64 `js:"minItems"`
	// Array of objects that correspond to items that the user has explicitly removed from custom categories in the Jump List. These items must not be re-added to the Jump List in the call to , Windows will not display any custom category that contains any of the removed items.
	RemovedItems *js.Object `js:"removedItems"`
}

type AppModuleGetLoginItemSettingsObj

type AppModuleGetLoginItemSettingsObj struct {
	*js.Object
	// if the app is set to open at login.
	OpenAtLogin bool `js:"openAtLogin"`
	// if the app is set to open as hidden at login. This setting is only supported on macOS.
	OpenAsHidden bool `js:"openAsHidden"`
	// if the app was opened at login automatically. This setting is only supported on macOS.
	WasOpenedAtLogin bool `js:"wasOpenedAtLogin"`
	// if the app was opened as a hidden login item. This indicates that the app should not open any windows at startup. This setting is only supported on macOS.
	WasOpenedAsHidden bool `js:"wasOpenedAsHidden"`
	// if the app was opened as a login item that should restore the state from the previous session. This indicates that the app should restore the windows that were open the last time the app was closed. This setting is only supported on macOS.
	RestoreState bool `js:"restoreState"`
}

type AppModuleImportCertificateCallback

type AppModuleImportCertificateCallback func(
	Result int64)

type AppModuleImportCertificateOptions

type AppModuleImportCertificateOptions struct {
	*js.Object
	// Path for the pkcs12 file.
	Certificate string `js:"certificate"`
	// Passphrase for the certificate.
	Password string `js:"password"`
}

type AppModuleMakeSingleInstanceCallback

type AppModuleMakeSingleInstanceCallback func(
	Argv *js.Object,
	WorkingDirectory string)

type AppModuleRelaunchOptions

type AppModuleRelaunchOptions struct {
	*js.Object
	// (optional)
	Args     *js.Object `js:"args"`
	ExecPath string     `js:"execPath"`
}

type AppModuleSetAboutPanelOptionsOptions

type AppModuleSetAboutPanelOptionsOptions struct {
	*js.Object
	// The app's name.
	ApplicationName string `js:"applicationName"`
	// The app's version.
	ApplicationVersion string `js:"applicationVersion"`
	// Copyright information.
	Copyright string `js:"copyright"`
	// Credit information.
	Credits string `js:"credits"`
	// The app's build version number.
	Version string `js:"version"`
}

type AppModuleSetLoginItemSettingsSettings

type AppModuleSetLoginItemSettingsSettings struct {
	*js.Object
	// to open the app at login, to remove the app as a login item. Defaults to .
	OpenAtLogin bool `js:"openAtLogin"`
	// to open the app as hidden. Defaults to . The user can edit this setting from the System Preferences so should be checked when the app is opened to know the current value. This setting is only supported on macOS.
	OpenAsHidden bool `js:"openAsHidden"`
}

type AppModuleSetUserActivityUserInfo

type AppModuleSetUserActivityUserInfo struct {
	*js.Object
}

type AutoUpdaterModule

type AutoUpdaterModule struct {
	*events.Emitter
	// Sets the url and initialize the auto updater.
	SetFeedURL func(URL string, RequestHeaders *AutoUpdaterModuleSetFeedURLRequestHeaders) `js:"setFeedURL"`
	GetFeedURL func() (Obj string)                                                         `js:"getFeedURL"`
	// Asks the server whether there is an update. You must call setFeedURL before using this API.
	CheckForUpdates func() `js:"checkForUpdates"`
	// Restarts the app and installs the update after it has been downloaded. It should only be called after update-downloaded has been emitted. Note: autoUpdater.quitAndInstall() will close all application windows first and only emit before-quit event on app after that. This is different from the normal quit event sequence.
	QuitAndInstall func() `js:"quitAndInstall"`
}

AutoUpdaterModule version@1.4.15

Enable apps to automatically update themselves.

func GetAutoUpdaterModule

func GetAutoUpdaterModule() *AutoUpdaterModule

type AutoUpdaterModuleSetFeedURLRequestHeaders

type AutoUpdaterModuleSetFeedURLRequestHeaders struct {
	*js.Object
}

type BluetoothDevice

type BluetoothDevice struct {
	*js.Object
	DeviceName string `js:"deviceName"`
	DeviceId   string `js:"deviceId"`
}

BluetoothDevice a Structure

type BrowserWindow

type BrowserWindow struct {
	*events.Emitter
	// A WebContents object this window owns. All web page related events and operations will be done via it. See the webContents documentation for its methods and events.
	WebContents *WebContents `js:"webContents"`
	// A Integer representing the unique ID of the window.
	Id int64 `js:"id"`
	// Force closing the window, the unload and beforeunload event won't be emitted for the web page, and close event will also not be emitted for this window, but it guarantees the closed event will be emitted.
	Destroy func() `js:"destroy"`
	// Try to close the window. This has the same effect as a user manually clicking the close button of the window. The web page may cancel the close though. See the close event.
	Close func() `js:"close"`
	// Focuses on the window.
	Focus func() `js:"focus"`
	// Removes focus from the window.
	Blur        func()            `js:"blur"`
	IsFocused   func() (Obj bool) `js:"isFocused"`
	IsDestroyed func() (Obj bool) `js:"isDestroyed"`
	// Shows and gives focus to the window.
	Show func() `js:"show"`
	// Shows the window but doesn't focus on it.
	ShowInactive func() `js:"showInactive"`
	// Hides the window.
	Hide      func()            `js:"hide"`
	IsVisible func() (Obj bool) `js:"isVisible"`
	IsModal   func() (Obj bool) `js:"isModal"`
	// Maximizes the window.
	Maximize func() `js:"maximize"`
	// Unmaximizes the window.
	Unmaximize  func()            `js:"unmaximize"`
	IsMaximized func() (Obj bool) `js:"isMaximized"`
	// Minimizes the window. On some platforms the minimized window will be shown in the Dock.
	Minimize func() `js:"minimize"`
	// Restores the window from minimized state to its previous state.
	Restore     func()            `js:"restore"`
	IsMinimized func() (Obj bool) `js:"isMinimized"`
	// Sets whether the window should be in fullscreen mode.
	SetFullScreen func(Flag bool)   `js:"setFullScreen"`
	IsFullScreen  func() (Obj bool) `js:"isFullScreen"`
	// This will make a window maintain an aspect ratio. The extra size allows a developer to have space, specified in pixels, not included within the aspect ratio calculations. This API already takes into account the difference between a window's size and its content size. Consider a normal window with an HD video player and associated controls. Perhaps there are 15 pixels of controls on the left edge, 25 pixels of controls on the right edge and 50 pixels of controls below the player. In order to maintain a 16:9 aspect ratio (standard aspect ratio for HD @1920x1080) within the player itself we would call this function with arguments of 16/9 and [ 40, 50 ]. The second argument doesn't care where the extra width and height are within the content view--only that they exist. Just sum any extra width and height areas you have within the overall content view.
	SetAspectRatio func(AspectRatio float64, ExtraSize *BrowserWindowSetAspectRatioExtraSize) `js:"setAspectRatio"`
	// Uses Quick Look to preview a file at a given path.
	PreviewFile func(Path string, DisplayName string) `js:"previewFile"`
	// Closes the currently open Quick Look panel.
	CloseFilePreview func() `js:"closeFilePreview"`
	// Resizes and moves the window to the supplied bounds
	SetBounds func(Bounds *js.Object, Animate bool) `js:"setBounds"`
	GetBounds func() (Obj *js.Object)               `js:"getBounds"`
	// Resizes and moves the window's client area (e.g. the web page) to the supplied bounds.
	SetContentBounds func(Bounds *js.Object, Animate bool) `js:"setContentBounds"`
	GetContentBounds func() (Obj *js.Object)               `js:"getContentBounds"`
	// Resizes the window to width and height.
	SetSize func(Width int64, Height int64, Animate bool) `js:"setSize"`
	GetSize func() (Obj *js.Object)                       `js:"getSize"`
	// Resizes the window's client area (e.g. the web page) to width and height.
	SetContentSize func(Width int64, Height int64, Animate bool) `js:"setContentSize"`
	GetContentSize func() (Obj *js.Object)                       `js:"getContentSize"`
	// Sets the minimum size of window to width and height.
	SetMinimumSize func(Width int64, Height int64) `js:"setMinimumSize"`
	GetMinimumSize func() (Obj *js.Object)         `js:"getMinimumSize"`
	// Sets the maximum size of window to width and height.
	SetMaximumSize func(Width int64, Height int64) `js:"setMaximumSize"`
	GetMaximumSize func() (Obj *js.Object)         `js:"getMaximumSize"`
	// Sets whether the window can be manually resized by user.
	SetResizable func(Resizable bool) `js:"setResizable"`
	IsResizable  func() (Obj bool)    `js:"isResizable"`
	// Sets whether the window can be moved by user. On Linux does nothing.
	SetMovable func(Movable bool) `js:"setMovable"`
	// On Linux always returns true.
	IsMovable func() (Obj bool) `js:"isMovable"`
	// Sets whether the window can be manually minimized by user. On Linux does nothing.
	SetMinimizable func(Minimizable bool) `js:"setMinimizable"`
	// On Linux always returns true.
	IsMinimizable func() (Obj bool) `js:"isMinimizable"`
	// Sets whether the window can be manually maximized by user. On Linux does nothing.
	SetMaximizable func(Maximizable bool) `js:"setMaximizable"`
	// On Linux always returns true.
	IsMaximizable func() (Obj bool) `js:"isMaximizable"`
	// Sets whether the maximize/zoom window button toggles fullscreen mode or maximizes the window.
	SetFullScreenable func(Fullscreenable bool) `js:"setFullScreenable"`
	IsFullScreenable  func() (Obj bool)         `js:"isFullScreenable"`
	// Sets whether the window can be manually closed by user. On Linux does nothing.
	SetClosable func(Closable bool) `js:"setClosable"`
	// On Linux always returns true.
	IsClosable func() (Obj bool) `js:"isClosable"`
	// Sets whether the window should show always on top of other windows. After setting this, the window is still a normal window, not a toolbox window which can not be focused on.
	SetAlwaysOnTop func(Flag bool, Level BrowserWindowSetAlwaysOnTopLevel) `js:"setAlwaysOnTop"`
	IsAlwaysOnTop  func() (Obj bool)                                       `js:"isAlwaysOnTop"`
	// Moves window to the center of the screen.
	Center func() `js:"center"`
	// Moves window to x and y.
	SetPosition func(X int64, Y int64, Animate bool) `js:"setPosition"`
	GetPosition func() (Obj *js.Object)              `js:"getPosition"`
	// Changes the title of native window to title.
	SetTitle func(Title string) `js:"setTitle"`
	// Note: The title of web page can be different from the title of the native window.
	GetTitle func() (Obj string) `js:"getTitle"`
	// Changes the attachment point for sheets on macOS. By default, sheets are attached just below the window frame, but you may want to display them beneath a HTML-rendered toolbar. For example:
	SetSheetOffset func(OffsetY float64, OffsetX float64) `js:"setSheetOffset"`
	// Starts or stops flashing the window to attract user's attention.
	FlashFrame func(Flag bool) `js:"flashFrame"`
	// Makes the window not show in the taskbar.
	SetSkipTaskbar func(Skip bool) `js:"setSkipTaskbar"`
	// Enters or leaves the kiosk mode.
	SetKiosk func(Flag bool)   `js:"setKiosk"`
	IsKiosk  func() (Obj bool) `js:"isKiosk"`
	// The native type of the handle is HWND on Windows, NSView* on macOS, and Window (unsigned long) on Linux.
	GetNativeWindowHandle func() (Obj *js.Object) `js:"getNativeWindowHandle"`
	// Hooks a windows message. The callback is called when the message is received in the WndProc.
	HookWindowMessage     func(Message int64, Callback BrowserWindowHookWindowMessageCallback) `js:"hookWindowMessage"`
	IsWindowMessageHooked func(Message int64) (Obj bool)                                       `js:"isWindowMessageHooked"`
	// Unhook the window message.
	UnhookWindowMessage func(Message int64) `js:"unhookWindowMessage"`
	// Unhooks all of the window messages.
	UnhookAllWindowMessages func() `js:"unhookAllWindowMessages"`
	// Sets the pathname of the file the window represents, and the icon of the file will show in window's title bar.
	SetRepresentedFilename func(Filename string) `js:"setRepresentedFilename"`
	GetRepresentedFilename func() (Obj string)   `js:"getRepresentedFilename"`
	// Specifies whether the window’s document has been edited, and the icon in title bar will become gray when set to true.
	SetDocumentEdited func(Edited bool) `js:"setDocumentEdited"`
	IsDocumentEdited  func() (Obj bool) `js:"isDocumentEdited"`
	FocusOnWebView    func()            `js:"focusOnWebView"`
	BlurWebView       func()            `js:"blurWebView"`
	// Same as webContents.capturePage([rect, ]callback).
	CapturePage func(Rect *js.Object, Callback BrowserWindowCapturePageCallback) `js:"capturePage"`
	// Same as webContents.loadURL(url[, options]). The url can be a remote address (e.g. http://) or a path to a local HTML file using the file:// protocol. To ensure that file URLs are properly formatted, it is recommended to use Node's url.format method: You can load a URL using a POST request with URL-encoded data by doing the following:
	LoadURL func(URL string, Options *BrowserWindowLoadURLOptions) `js:"loadURL"`
	// Same as webContents.reload.
	Reload func() `js:"reload"`
	// Sets the menu as the window's menu bar, setting it to null will remove the menu bar.
	SetMenu func(Menu *Menu) `js:"setMenu"`
	// Sets progress value in progress bar. Valid range is [0, 1.0]. Remove progress bar when progress < 0; Change to indeterminate mode when progress > 1. On Linux platform, only supports Unity desktop environment, you need to specify the *.desktop file name to desktopName field in package.json. By default, it will assume app.getName().desktop. On Windows, a mode can be passed. Accepted values are none, normal, indeterminate, error, and paused. If you call setProgressBar without a mode set (but with a value within the valid range), normal will be assumed.
	SetProgressBar func(Progress float64, Options *BrowserWindowSetProgressBarOptions) `js:"setProgressBar"`
	// Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to convey some sort of application status or to passively notify the user.
	SetOverlayIcon func(Overlay *NativeImage, Description string) `js:"setOverlayIcon"`
	// Sets whether the window should have a shadow. On Windows and Linux does nothing.
	SetHasShadow func(HasShadow bool) `js:"setHasShadow"`
	// On Windows and Linux always returns true.
	HasShadow func() (Obj bool) `js:"hasShadow"`
	// Add a thumbnail toolbar with a specified set of buttons to the thumbnail image of a window in a taskbar button layout. Returns a Boolean object indicates whether the thumbnail has been added successfully. The number of buttons in thumbnail toolbar should be no greater than 7 due to the limited room. Once you setup the thumbnail toolbar, the toolbar cannot be removed due to the platform's limitation. But you can call the API with an empty array to clean the buttons. The buttons is an array of Button objects: The flags is an array that can include following Strings:
	SetThumbarButtons func(Buttons *js.Object) (Obj bool) `js:"setThumbarButtons"`
	// Sets the region of the window to show as the thumbnail image displayed when hovering over the window in the taskbar. You can reset the thumbnail to be the entire window by specifying an empty region: {x: 0, y: 0, width: 0, height: 0}.
	SetThumbnailClip func(Region *js.Object) `js:"setThumbnailClip"`
	// Sets the toolTip that is displayed when hovering over the window thumbnail in the taskbar.
	SetThumbnailToolTip func(ToolTip string) `js:"setThumbnailToolTip"`
	// Sets the properties for the window's taskbar button. Note: relaunchCommand and relaunchDisplayName must always be set together. If one of those properties is not set, then neither will be used.
	SetAppDetails func(Options *BrowserWindowSetAppDetailsOptions) `js:"setAppDetails"`
	// Same as webContents.showDefinitionForSelection().
	ShowDefinitionForSelection func() `js:"showDefinitionForSelection"`
	// Changes window icon.
	SetIcon func(Icon *NativeImage) `js:"setIcon"`
	// Sets whether the window menu bar should hide itself automatically. Once set the menu bar will only show when users press the single Alt key. If the menu bar is already visible, calling setAutoHideMenuBar(true) won't hide it immediately.
	SetAutoHideMenuBar func(Hide bool)   `js:"setAutoHideMenuBar"`
	IsMenuBarAutoHide  func() (Obj bool) `js:"isMenuBarAutoHide"`
	// Sets whether the menu bar should be visible. If the menu bar is auto-hide, users can still bring up the menu bar by pressing the single Alt key.
	SetMenuBarVisibility func(Visible bool) `js:"setMenuBarVisibility"`
	IsMenuBarVisible     func() (Obj bool)  `js:"isMenuBarVisible"`
	// Sets whether the window should be visible on all workspaces. Note: This API does nothing on Windows.
	SetVisibleOnAllWorkspaces func(Visible bool) `js:"setVisibleOnAllWorkspaces"`
	// Note: This API always returns false on Windows.
	IsVisibleOnAllWorkspaces func() (Obj bool) `js:"isVisibleOnAllWorkspaces"`
	// Makes the window ignore all mouse events. All mouse events happened in this window will be passed to the window below this window, but if this window has focus, it will still receive keyboard events.
	SetIgnoreMouseEvents func(Ignore bool) `js:"setIgnoreMouseEvents"`
	// Prevents the window contents from being captured by other apps. On macOS it sets the NSWindow's sharingType to NSWindowSharingNone. On Windows it calls SetWindowDisplayAffinity with WDA_MONITOR.
	SetContentProtection func(Enable bool) `js:"setContentProtection"`
	// Changes whether the window can be focused.
	SetFocusable func(Focusable bool) `js:"setFocusable"`
	// Sets parent as current window's parent window, passing null will turn current window into a top-level window.
	SetParentWindow func(Parent *BrowserWindow) `js:"setParentWindow"`
	GetParentWindow func() (Obj *BrowserWindow) `js:"getParentWindow"`
	GetChildWindows func() (Obj *js.Object)     `js:"getChildWindows"`
	// Controls whether to hide cursor when typing.
	SetAutoHideCursor func(AutoHide bool) `js:"setAutoHideCursor"`
	// Adds a vibrancy effect to the browser window. Passing null or an empty string will remove the vibrancy effect on the window.
	SetVibrancy func(Type BrowserWindowSetVibrancyType) `js:"setVibrancy"`
}

BrowserWindow version@1.4.15

Create and control browser windows.

func NewBrowserWindow

func NewBrowserWindow(Options *BrowserWindowBrowserWindowOptions) *BrowserWindow

func WrapBrowserWindow

func WrapBrowserWindow(o *js.Object) *BrowserWindow

type BrowserWindowBrowserWindowOptions

type BrowserWindowBrowserWindowOptions struct {
	*js.Object
	// Window's width in pixels. Default is .
	Width int64 `js:"width"`
	// Window's height in pixels. Default is .
	Height int64 `js:"height"`
	// ( if y is used) Window's left offset from screen. Default is to center the window.
	X int64 `js:"x"`
	// ( if x is used) Window's top offset from screen. Default is to center the window.
	Y int64 `js:"y"`
	// The and would be used as web page's size, which means the actual window's size will include window frame's size and be slightly larger. Default is .
	UseContentSize bool `js:"useContentSize"`
	// Show window in the center of the screen.
	Center bool `js:"center"`
	// Window's minimum width. Default is .
	MinWidth int64 `js:"minWidth"`
	// Window's minimum height. Default is .
	MinHeight int64 `js:"minHeight"`
	// Window's maximum width. Default is no limit.
	MaxWidth int64 `js:"maxWidth"`
	// Window's maximum height. Default is no limit.
	MaxHeight int64 `js:"maxHeight"`
	// Whether window is resizable. Default is .
	Resizable bool `js:"resizable"`
	// Whether window is movable. This is not implemented on Linux. Default is .
	Movable bool `js:"movable"`
	// Whether window is minimizable. This is not implemented on Linux. Default is .
	Minimizable bool `js:"minimizable"`
	// Whether window is maximizable. This is not implemented on Linux. Default is .
	Maximizable bool `js:"maximizable"`
	// Whether window is closable. This is not implemented on Linux. Default is .
	Closable bool `js:"closable"`
	// Whether the window can be focused. Default is . On Windows setting also implies setting . On Linux setting makes the window stop interacting with wm, so the window will always stay on top in all workspaces.
	Focusable bool `js:"focusable"`
	// Whether the window should always stay on top of other windows. Default is .
	AlwaysOnTop bool `js:"alwaysOnTop"`
	// Whether the window should show in fullscreen. When explicitly set to the fullscreen button will be hidden or disabled on macOS. Default is .
	Fullscreen bool `js:"fullscreen"`
	// Whether the window can be put into fullscreen mode. On macOS, also whether the maximize/zoom button should toggle full screen mode or maximize window. Default is .
	Fullscreenable bool `js:"fullscreenable"`
	// Whether to show the window in taskbar. Default is .
	SkipTaskbar bool `js:"skipTaskbar"`
	// The kiosk mode. Default is .
	Kiosk bool `js:"kiosk"`
	// Default window title. Default is .
	Title string `js:"title"`
	// The window icon. On Windows it is recommended to use icons to get best visual effects, you can also leave it undefined so the executable's icon will be used.
	Icon *NativeImage `js:"icon"`
	// Whether window should be shown when created. Default is .
	Show bool `js:"show"`
	// Specify to create a . Default is .
	Frame bool `js:"frame"`
	// Specify parent window. Default is .
	Parent *BrowserWindow `js:"parent"`
	// Whether this is a modal window. This only works when the window is a child window. Default is .
	Modal bool `js:"modal"`
	// Whether the web view accepts a single mouse-down event that simultaneously activates the window. Default is .
	AcceptFirstMouse bool `js:"acceptFirstMouse"`
	// Whether to hide cursor when typing. Default is .
	DisableAutoHideCursor bool `js:"disableAutoHideCursor"`
	// Auto hide the menu bar unless the key is pressed. Default is .
	AutoHideMenuBar bool `js:"autoHideMenuBar"`
	// Enable the window to be resized larger than screen. Default is .
	EnableLargerThanScreen bool `js:"enableLargerThanScreen"`
	// Window's background color as Hexadecimal value, like or or (alpha is supported). Default is (white).
	BackgroundColor string `js:"backgroundColor"`
	// Whether window should have a shadow. This is only implemented on macOS. Default is .
	HasShadow bool `js:"hasShadow"`
	// Forces using dark theme for the window, only works on some GTK+3 desktop environments. Default is .
	DarkTheme bool `js:"darkTheme"`
	// Makes the window . Default is .
	Transparent bool `js:"transparent"`
	// The type of window, default is normal window. See more about this below.
	Type string `js:"type"`
	// The style of window title bar. Default is . Possible values are:
	TitleBarStyle BrowserWindowOptionsTitleBarStyle `js:"titleBarStyle"`
	// Use style for frameless windows on Windows, which adds standard window frame. Setting it to will remove window shadow and window animations. Default is .
	ThickFrame bool `js:"thickFrame"`
	// Add a type of vibrancy effect to the window, only on macOS. Can be , , , , , , , , or .
	Vibrancy BrowserWindowOptionsVibrancy `js:"vibrancy"`
	// Controls the behavior on macOS when option-clicking the green stoplight button on the toolbar or by clicking the Window > Zoom menu item. If , the window will grow to the preferred width of the web page when zoomed, will cause it to zoom to the width of the screen. This will also affect the behavior when calling directly. Default is .
	ZoomToPageWidth bool `js:"zoomToPageWidth"`
	// Settings of web page's features.
	WebPreferences *BrowserWindowOptionsWebPreferences `js:"webPreferences"`
}

func NewBrowserWindowOption

func NewBrowserWindowOption() *BrowserWindowBrowserWindowOptions

type BrowserWindowCapturePageCallback

type BrowserWindowCapturePageCallback func(Image *NativeImage)

type BrowserWindowHookWindowMessageCallback

type BrowserWindowHookWindowMessageCallback func()

type BrowserWindowLoadURLOptions

type BrowserWindowLoadURLOptions struct {
	*js.Object
	// A HTTP Referrer url.
	HttpReferrer string `js:"httpReferrer"`
	// A user agent originating the request.
	UserAgent string `js:"userAgent"`
	// Extra headers separated by "\n"
	ExtraHeaders string `js:"extraHeaders"`
	// [] (optional)
	PostData *js.Object `js:"postData"`
}

type BrowserWindowOptionsMode

type BrowserWindowOptionsMode string
const (
	BrowserWindowOptionsModeNone          BrowserWindowOptionsMode = "none"
	BrowserWindowOptionsModeNormal        BrowserWindowOptionsMode = "normal"
	BrowserWindowOptionsModeIndeterminate BrowserWindowOptionsMode = "indeterminate"
	BrowserWindowOptionsModeError         BrowserWindowOptionsMode = "error"
)

consts

type BrowserWindowOptionsTitleBarStyle

type BrowserWindowOptionsTitleBarStyle string
const (
	BrowserWindowOptionsTitleBarStyleDefault     BrowserWindowOptionsTitleBarStyle = "default"
	BrowserWindowOptionsTitleBarStyleHidden      BrowserWindowOptionsTitleBarStyle = "hidden"
	BrowserWindowOptionsTitleBarStyleHiddenInset BrowserWindowOptionsTitleBarStyle = "hidden-inset"
)

consts

type BrowserWindowOptionsVibrancy

type BrowserWindowOptionsVibrancy string
const (
	BrowserWindowOptionsVibrancyAppearanceBased BrowserWindowOptionsVibrancy = "appearance-based"
	BrowserWindowOptionsVibrancyLight           BrowserWindowOptionsVibrancy = "light"
	BrowserWindowOptionsVibrancyDark            BrowserWindowOptionsVibrancy = "dark"
	BrowserWindowOptionsVibrancyTitlebar        BrowserWindowOptionsVibrancy = "titlebar"
	BrowserWindowOptionsVibrancySelection       BrowserWindowOptionsVibrancy = "selection"
	BrowserWindowOptionsVibrancyMenu            BrowserWindowOptionsVibrancy = "menu"
	BrowserWindowOptionsVibrancyPopover         BrowserWindowOptionsVibrancy = "popover"
	BrowserWindowOptionsVibrancySidebar         BrowserWindowOptionsVibrancy = "sidebar"
	BrowserWindowOptionsVibrancyMediumLight     BrowserWindowOptionsVibrancy = "medium-light"
	BrowserWindowOptionsVibrancyUltraDark       BrowserWindowOptionsVibrancy = "ultra-dark"
)

consts

type BrowserWindowOptionsWebPreferences

type BrowserWindowOptionsWebPreferences struct {
	*js.Object
	// Whether to enable DevTools. If it is set to , can not use to open DevTools. Default is .
	DevTools bool `js:"devTools"`
	// Whether node integration is enabled. Default is .
	NodeIntegration bool `js:"nodeIntegration"`
	// Specifies a script that will be loaded before other scripts run in the page. This script will always have access to node APIs no matter whether node integration is turned on or off. The value should be the absolute file path to the script. When node integration is turned off, the preload script can reintroduce Node global symbols back to the global scope. See example .
	Preload string `js:"preload"`
	// Sets the session used by the page. Instead of passing the Session object directly, you can also choose to use the option instead, which accepts a partition string. When both and are provided, will be preferred. Default is the default session.
	Session *Session `js:"session"`
	// Sets the session used by the page according to the session's partition string. If starts with , the page will use a persistent session available to all pages in the app with the same . If there is no prefix, the page will use an in-memory session. By assigning the same , multiple pages can share the same session. Default is the default session.
	Partition string `js:"partition"`
	// The default zoom factor of the page, represents . Default is .
	ZoomFactor float64 `js:"zoomFactor"`
	// Enables JavaScript support. Default is .
	Javascript bool `js:"javascript"`
	// When , it will disable the same-origin policy (usually using testing websites by people), and set and to if these two options are not set by user. Default is .
	WebSecurity bool `js:"webSecurity"`
	// Allow an https page to display content like images from http URLs. Default is .
	AllowDisplayingInsecureContent bool `js:"allowDisplayingInsecureContent"`
	// Allow an https page to run JavaScript, CSS or plugins from http URLs. Default is .
	AllowRunningInsecureContent bool `js:"allowRunningInsecureContent"`
	// Enables image support. Default is .
	Images bool `js:"images"`
	// Make TextArea elements resizable. Default is .
	TextAreasAreResizable bool `js:"textAreasAreResizable"`
	// Enables WebGL support. Default is .
	Webgl bool `js:"webgl"`
	// Enables WebAudio support. Default is .
	Webaudio bool `js:"webaudio"`
	// Whether plugins should be enabled. Default is .
	Plugins bool `js:"plugins"`
	// Enables Chromium's experimental features. Default is .
	ExperimentalFeatures bool `js:"experimentalFeatures"`
	// Enables Chromium's experimental canvas features. Default is .
	ExperimentalCanvasFeatures bool `js:"experimentalCanvasFeatures"`
	// Enables scroll bounce (rubber banding) effect on macOS. Default is .
	ScrollBounce bool `js:"scrollBounce"`
	// A list of feature strings separated by , like to enable. The full list of supported feature strings can be found in the file.
	BlinkFeatures string `js:"blinkFeatures"`
	// A list of feature strings separated by , like to disable. The full list of supported feature strings can be found in the file.
	DisableBlinkFeatures string `js:"disableBlinkFeatures"`
	// Sets the default font for the font-family.
	DefaultFontFamily *BrowserWindowWebPreferencesDefaultFontFamily `js:"defaultFontFamily"`
	// Defaults to .
	DefaultFontSize int64 `js:"defaultFontSize"`
	// Defaults to .
	DefaultMonospaceFontSize int64 `js:"defaultMonospaceFontSize"`
	// Defaults to .
	MinimumFontSize int64 `js:"minimumFontSize"`
	// Defaults to .
	DefaultEncoding string `js:"defaultEncoding"`
	// Whether to throttle animations and timers when the page becomes background. Defaults to .
	BackgroundThrottling bool `js:"backgroundThrottling"`
	// Whether to enable offscreen rendering for the browser window. Defaults to . See the for more details.
	Offscreen bool `js:"offscreen"`
	// Whether to enable Chromium OS-level sandbox.
	Sandbox bool `js:"sandbox"`
	// Whether to run Electron APIs and the specified script in a separate JavaScript context. Defaults to . The context that the script runs in will still have full access to the and globals but it will use its own set of JavaScript builtins (, , , etc.) and will be isolated from any changes made to the global environment by the loaded page. The Electron API will only be available in the script and not the loaded page. This option should be used when loading potentially untrusted remote content to ensure the loaded content cannot tamper with the script and any Electron APIs being used. This option uses the same technique used by . You can access this context in the dev tools by selecting the 'Electron Isolated Context' entry in the combo box at the top of the Console tab. This option is currently experimental and may change or be removed in future Electron releases.
	ContextIsolation bool `js:"contextIsolation"`
}

type BrowserWindowProxy

type BrowserWindowProxy struct {
	*js.Object
	// A Boolean that is set to true after the child window gets closed.
	Closed bool `js:"closed"`
	// Removes focus from the child window.
	Blur func() `js:"blur"`
	// Forcefully closes the child window without calling its unload event.
	Close func() `js:"close"`
	// Evaluates the code in the child window.
	Eval func(Code string) `js:"eval"`
	// Focuses the child window (brings the window to front).
	Focus func() `js:"focus"`
	// Invokes the print dialog on the child window.
	Print func() `js:"print"`
	// Sends a message to the child window with the specified origin or * for no origin preference. In addition to these methods, the child window implements window.opener object with no properties and a single method.
	PostMessage func(Message string, TargetOrigin string) `js:"postMessage"`
}

BrowserWindowProxy version@1.4.15

Manipulate the child browser window

func WrapBrowserWindowProxy

func WrapBrowserWindowProxy(o *js.Object) *BrowserWindowProxy

type BrowserWindowSetAlwaysOnTopLevel

type BrowserWindowSetAlwaysOnTopLevel string
const (
	BrowserWindowSetAlwaysOnTopLevelNormal      BrowserWindowSetAlwaysOnTopLevel = "normal"
	BrowserWindowSetAlwaysOnTopLevelFloating    BrowserWindowSetAlwaysOnTopLevel = "floating"
	BrowserWindowSetAlwaysOnTopLevelTornOffMenu BrowserWindowSetAlwaysOnTopLevel = "torn-off-menu"
	BrowserWindowSetAlwaysOnTopLevelModalPanel  BrowserWindowSetAlwaysOnTopLevel = "modal-panel"
	BrowserWindowSetAlwaysOnTopLevelMainMenu    BrowserWindowSetAlwaysOnTopLevel = "main-menu"
	BrowserWindowSetAlwaysOnTopLevelStatus      BrowserWindowSetAlwaysOnTopLevel = "status"
	BrowserWindowSetAlwaysOnTopLevelPopUpMenu   BrowserWindowSetAlwaysOnTopLevel = "pop-up-menu"
	BrowserWindowSetAlwaysOnTopLevelScreenSaver BrowserWindowSetAlwaysOnTopLevel = "screen-saver"
)

consts

type BrowserWindowSetAppDetailsOptions

type BrowserWindowSetAppDetailsOptions struct {
	*js.Object
	// Window's . It has to be set, otherwise the other options will have no effect.
	AppId string `js:"appId"`
	// Window's .
	AppIconPath string `js:"appIconPath"`
	// Index of the icon in . Ignored when is not set. Default is .
	AppIconIndex int64 `js:"appIconIndex"`
	// Window's .
	RelaunchCommand string `js:"relaunchCommand"`
	// Window's .
	RelaunchDisplayName string `js:"relaunchDisplayName"`
}

type BrowserWindowSetAspectRatioExtraSize

type BrowserWindowSetAspectRatioExtraSize struct {
	*js.Object
	Width  int64 `js:"width"`
	Height int64 `js:"height"`
}

type BrowserWindowSetProgressBarOptions

type BrowserWindowSetProgressBarOptions struct {
	*js.Object
	// Mode for the progress bar. Can be , , , , or .
	Mode BrowserWindowOptionsMode `js:"mode"`
}

type BrowserWindowSetVibrancyType

type BrowserWindowSetVibrancyType string
const (
	BrowserWindowSetVibrancyTypeAppearanceBased BrowserWindowSetVibrancyType = "appearance-based"
	BrowserWindowSetVibrancyTypeLight           BrowserWindowSetVibrancyType = "light"
	BrowserWindowSetVibrancyTypeDark            BrowserWindowSetVibrancyType = "dark"
	BrowserWindowSetVibrancyTypeTitlebar        BrowserWindowSetVibrancyType = "titlebar"
	BrowserWindowSetVibrancyTypeSelection       BrowserWindowSetVibrancyType = "selection"
	BrowserWindowSetVibrancyTypeMenu            BrowserWindowSetVibrancyType = "menu"
	BrowserWindowSetVibrancyTypePopover         BrowserWindowSetVibrancyType = "popover"
	BrowserWindowSetVibrancyTypeSidebar         BrowserWindowSetVibrancyType = "sidebar"
	BrowserWindowSetVibrancyTypeMediumLight     BrowserWindowSetVibrancyType = "medium-light"
	BrowserWindowSetVibrancyTypeUltraDark       BrowserWindowSetVibrancyType = "ultra-dark"
)

consts

type BrowserWindowWebPreferencesDefaultFontFamily

type BrowserWindowWebPreferencesDefaultFontFamily struct {
	*js.Object
	// Defaults to .
	Standard string `js:"standard"`
	// Defaults to .
	Serif string `js:"serif"`
	// Defaults to .
	SansSerif string `js:"sansSerif"`
	// Defaults to .
	Monospace string `js:"monospace"`
	// Defaults to .
	Cursive string `js:"cursive"`
	// Defaults to .
	Fantasy string `js:"fantasy"`
}

type Certificate

type Certificate struct {
	*js.Object
	// PEM encoded data
	Data string `js:"data"`
	// Issuer principal
	Issuer *js.Object `js:"issuer"`
	// Issuer's Common Name
	IssuerName string `js:"issuerName"`
	// Issuer certificate (if not self-signed)
	IssuerCert *js.Object `js:"issuerCert"`
	// Subject principal
	Subject *js.Object `js:"subject"`
	// Subject's Common Name
	SubjectName string `js:"subjectName"`
	// Hex value represented string
	SerialNumber string `js:"serialNumber"`
	// Start date of the certificate being valid in seconds
	ValidStart float64 `js:"validStart"`
	// End date of the certificate being valid in seconds
	ValidExpiry float64 `js:"validExpiry"`
	// Fingerprint of the certificate
	Fingerprint string `js:"fingerprint"`
}

Certificate a Structure

type CertificatePrincipal

type CertificatePrincipal struct {
	*js.Object
	// Common Name
	CommonName string `js:"commonName"`
	// Organization names
	Organizations *js.Object `js:"organizations"`
	// Organization Unit names
	OrganizationUnits *js.Object `js:"organizationUnits"`
	// Locality
	Locality string `js:"locality"`
	// State or province
	State string `js:"state"`
	// Country or region
	Country string `js:"country"`
}

CertificatePrincipal a Structure

type ClientRequest

type ClientRequest struct {
	*events.Emitter
	// A Boolean specifying whether the request will use HTTP chunked transfer encoding or not. Defaults to false. The property is readable and writable, however it can be set only before the first write operation as the HTTP headers are not yet put on the wire. Trying to set the chunkedEncoding property after the first write will throw an error. Using chunked encoding is strongly recommended if you need to send a large request body as data will be streamed in small chunks instead of being internally buffered inside Electron process memory.
	ChunkedEncoding bool `js:"chunkedEncoding"`
	// Adds an extra HTTP header. The header name will issued as it is without lowercasing. It can be called only before first write. Calling this method after the first write will throw an error.
	SetHeader func(Name string, Value string) `js:"setHeader"`
	// Returns String - The value of a previously set extra header name.
	GetHeader func(Name string) `js:"getHeader"`
	// Removes a previously set extra header name. This method can be called only before first write. Trying to call it after the first write will throw an error.
	RemoveHeader func(Name string) `js:"removeHeader"`
	// callback is essentially a dummy function introduced in the purpose of keeping similarity with the Node.js API. It is called asynchronously in the next tick after chunk content have been delivered to the Chromium networking layer. Contrary to the Node.js implementation, it is not guaranteed that chunk content have been flushed on the wire before callback is called. Adds a chunk of data to the request body. The first write operation may cause the request headers to be issued on the wire. After the first write operation, it is not allowed to add or remove a custom header.
	Write func(Chunk string, Encoding string, Callback ClientRequestWriteCallback) `js:"write"`
	// Sends the last chunk of the request data. Subsequent write or end operations will not be allowed. The finish event is emitted just after the end operation.
	End func(Chunk string, Encoding string, Callback ClientRequestEndCallback) `js:"end"`
	// Cancels an ongoing HTTP transaction. If the request has already emitted the close event, the abort operation will have no effect. Otherwise an ongoing event will emit abort and close events. Additionally, if there is an ongoing response object,it will emit the aborted event.
	Abort func() `js:"abort"`
}

ClientRequest version@1.4.15

Make HTTP/HTTPS requests.

func NewClientRequest

func NewClientRequest(Options *ClientRequestClientRequestOptions) *ClientRequest

func WrapClientRequest

func WrapClientRequest(o *js.Object) *ClientRequest

type ClientRequestClientRequestOptions

type ClientRequestClientRequestOptions struct {
	*js.Object
}

type ClientRequestEndCallback

type ClientRequestEndCallback func()

type ClientRequestWriteCallback

type ClientRequestWriteCallback func()

type ClipboardModule

type ClipboardModule struct {
	*js.Object
	ReadText func(Type string) (Obj string) `js:"readText"`
	// Writes the text into the clipboard as plain text.
	WriteText func(Text string, Type string) `js:"writeText"`
	ReadHTML  func(Type string) (Obj string) `js:"readHTML"`
	// Writes markup to the clipboard.
	WriteHTML func(Markup string, Type string)     `js:"writeHTML"`
	ReadImage func(Type string) (Obj *NativeImage) `js:"readImage"`
	// Writes image to the clipboard.
	WriteImage func(Image *NativeImage, Type string) `js:"writeImage"`
	ReadRTF    func(Type string) (Obj string)        `js:"readRTF"`
	// Writes the text into the clipboard in RTF.
	WriteRTF func(Text string, Type string) `js:"writeRTF"`
	// Returns an Object containing title and url keys representing the bookmark in the clipboard. The title and url values will be empty strings when the bookmark is unavailable.
	ReadBookmark func() (Obj *ClipboardModuleReadBookmarkObj) `js:"readBookmark"`
	// Writes the title and url into the clipboard as a bookmark. Note: Most apps on Windows don't support pasting bookmarks into them so you can use clipboard.write to write both a bookmark and fallback text to the clipboard.
	WriteBookmark func(Title string, URL string, Type string) `js:"writeBookmark"`
	ReadFindText  func() (Obj string)                         `js:"readFindText"`
	// Writes the text into the find pasteboard as plain text. This method uses synchronous IPC when called from the renderer process.
	WriteFindText func(Text string) `js:"writeFindText"`
	// Clears the clipboard content.
	Clear            func(Type string)                           `js:"clear"`
	AvailableFormats func(Type string) (Obj *js.Object)          `js:"availableFormats"`
	Has              func(Data string, Type string) (Obj bool)   `js:"has"`
	Read             func(Data string, Type string) (Obj string) `js:"read"`
	// Writes data to the clipboard.
	Write func(Data *ClipboardModuleWriteData, Type string) `js:"write"`
}

ClipboardModule version@1.4.15

Perform copy and paste operations on the system clipboard.

func GetClipboardModule

func GetClipboardModule() *ClipboardModule

type ClipboardModuleReadBookmarkObj

type ClipboardModuleReadBookmarkObj struct {
	*js.Object
	Title string `js:"title"`
	URL   string `js:"url"`
}

type ClipboardModuleWriteData

type ClipboardModuleWriteData struct {
	*js.Object
	Text  string       `js:"text"`
	Html  string       `js:"html"`
	Image *NativeImage `js:"image"`
	Rtf   string       `js:"rtf"`
	// The title of the url at .
	Bookmark string `js:"bookmark"`
}

type ContentTracingModule

type ContentTracingModule struct {
	*js.Object
	// Get a set of category groups. The category groups can change as new code paths are reached. Once all child processes have acknowledged the getCategories request the callback is invoked with an array of category groups.
	GetCategories func(Callback ContentTracingModuleGetCategoriesCallback) `js:"getCategories"`
	// Start recording on all processes. Recording begins immediately locally and asynchronously on child processes as soon as they receive the EnableRecording request. The callback will be called once all child processes have acknowledged the startRecording request. categoryFilter is a filter to control what category groups should be traced. A filter can have an optional - prefix to exclude category groups that contain a matching category. Having both included and excluded category patterns in the same list is not supported. Examples: traceOptions controls what kind of tracing is enabled, it is a comma-delimited list. Possible options are: The first 3 options are trace recoding modes and hence mutually exclusive. If more than one trace recording modes appear in the traceOptions string, the last one takes precedence. If none of the trace recording modes are specified, recording mode is record-until-full. The trace option will first be reset to the default option (record_mode set to record-until-full, enable_sampling and enable_systrace set to false) before options parsed from traceOptions are applied on it.
	StartRecording func(Options *ContentTracingModuleStartRecordingOptions, Callback ContentTracingModuleStartRecordingCallback) `js:"startRecording"`
	// Stop recording on all processes. Child processes typically cache trace data and only rarely flush and send trace data back to the main process. This helps to minimize the runtime overhead of tracing since sending trace data over IPC can be an expensive operation. So, to end tracing, we must asynchronously ask all child processes to flush any pending trace data. Once all child processes have acknowledged the stopRecording request, callback will be called with a file that contains the traced data. Trace data will be written into resultFilePath if it is not empty or into a temporary file. The actual file path will be passed to callback if it's not null.
	StopRecording func(ResultFilePath string, Callback ContentTracingModuleStopRecordingCallback) `js:"stopRecording"`
	// Start monitoring on all processes. Monitoring begins immediately locally and asynchronously on child processes as soon as they receive the startMonitoring request. Once all child processes have acknowledged the startMonitoring request the callback will be called.
	StartMonitoring func(Options *ContentTracingModuleStartMonitoringOptions, Callback ContentTracingModuleStartMonitoringCallback) `js:"startMonitoring"`
	// Stop monitoring on all processes. Once all child processes have acknowledged the stopMonitoring request the callback is called.
	StopMonitoring func(Callback ContentTracingModuleStopMonitoringCallback) `js:"stopMonitoring"`
	// Get the current monitoring traced data. Child processes typically cache trace data and only rarely flush and send trace data back to the main process. This is because it may be an expensive operation to send the trace data over IPC and we would like to avoid unneeded runtime overhead from tracing. So, to end tracing, we must asynchronously ask all child processes to flush any pending trace data. Once all child processes have acknowledged the captureMonitoringSnapshot request the callback will be called with a file that contains the traced data.
	CaptureMonitoringSnapshot func(ResultFilePath string, Callback ContentTracingModuleCaptureMonitoringSnapshotCallback) `js:"captureMonitoringSnapshot"`
	// Get the maximum usage across processes of trace buffer as a percentage of the full state. When the TraceBufferUsage value is determined the callback is called.
	GetTraceBufferUsage func(Callback ContentTracingModuleGetTraceBufferUsageCallback) `js:"getTraceBufferUsage"`
	// callback will be called every time the given event occurs on any process.
	SetWatchEvent func(CategoryName string, EventName string, Callback ContentTracingModuleSetWatchEventCallback) `js:"setWatchEvent"`
	// Cancel the watch event. This may lead to a race condition with the watch event callback if tracing is enabled.
	CancelWatchEvent func() `js:"cancelWatchEvent"`
}

ContentTracingModule version@1.4.15

Collect tracing data from Chromium's content module for finding performance bottlenecks and slow operations.

func GetContentTracingModule

func GetContentTracingModule() *ContentTracingModule

type ContentTracingModuleCaptureMonitoringSnapshotCallback

type ContentTracingModuleCaptureMonitoringSnapshotCallback func(ResultFilePath string)

type ContentTracingModuleGetCategoriesCallback

type ContentTracingModuleGetCategoriesCallback func(Categories *js.Object)

type ContentTracingModuleGetTraceBufferUsageCallback

type ContentTracingModuleGetTraceBufferUsageCallback func(Value float64, Percentage float64)

type ContentTracingModuleSetWatchEventCallback

type ContentTracingModuleSetWatchEventCallback func()

type ContentTracingModuleStartMonitoringCallback

type ContentTracingModuleStartMonitoringCallback func()

type ContentTracingModuleStartMonitoringOptions

type ContentTracingModuleStartMonitoringOptions struct {
	*js.Object
	CategoryFilter string `js:"categoryFilter"`
	TraceOptions   string `js:"traceOptions"`
}

type ContentTracingModuleStartRecordingCallback

type ContentTracingModuleStartRecordingCallback func()

type ContentTracingModuleStartRecordingOptions

type ContentTracingModuleStartRecordingOptions struct {
	*js.Object
	CategoryFilter string `js:"categoryFilter"`
	TraceOptions   string `js:"traceOptions"`
}

type ContentTracingModuleStopMonitoringCallback

type ContentTracingModuleStopMonitoringCallback func()

type ContentTracingModuleStopRecordingCallback

type ContentTracingModuleStopRecordingCallback func(ResultFilePath string)
type Cookie struct {
	*js.Object
	// The name of the cookie.
	Name string `js:"name"`
	// The value of the cookie.
	Value string `js:"value"`
	// The domain of the cookie.
	Domain string `js:"domain"`
	// Whether the cookie is a host-only cookie.
	HostOnly bool `js:"hostOnly"`
	// The path of the cookie.
	Path string `js:"path"`
	// Whether the cookie is marked as secure.
	Secure bool `js:"secure"`
	// Whether the cookie is marked as HTTP only.
	HttpOnly bool `js:"httpOnly"`
	// Whether the cookie is a session cookie or a persistent cookie with an expiration date.
	Session bool `js:"session"`
	// The expiration date of the cookie as the number of seconds since the UNIX epoch. Not provided for session cookies.
	ExpirationDate float64 `js:"expirationDate"`
}

Cookie a Structure

type Cookies

type Cookies struct {
	*events.Emitter
	// Sends a request to get all cookies matching details, callback will be called with callback(error, cookies) on complete. cookies is an Array of cookie objects.
	Get func(Filter *CookiesGetFilter, Callback CookiesGetCallback) `js:"get"`
	// Sets a cookie with details, callback will be called with callback(error) on complete.
	Set func(Details *CookiesSetDetails, Callback CookiesSetCallback) `js:"set"`
	// Removes the cookies matching url and name, callback will called with callback() on complete.
	Remove func(URL string, Name string, Callback CookiesRemoveCallback) `js:"remove"`
}

Cookies version@1.4.15

Query and modify a session's cookies.

func WrapCookies

func WrapCookies(o *js.Object) *Cookies

type CookiesGetCallback

type CookiesGetCallback func(Error *js.Object, Cookies *js.Object)

type CookiesGetFilter

type CookiesGetFilter struct {
	*js.Object
	// Retrieves cookies which are associated with . Empty implies retrieving cookies of all urls.
	URL string `js:"url"`
	// Filters cookies by name.
	Name string `js:"name"`
	// Retrieves cookies whose domains match or are subdomains of
	Domain string `js:"domain"`
	// Retrieves cookies whose path matches .
	Path string `js:"path"`
	// Filters cookies by their Secure property.
	Secure bool `js:"secure"`
	// Filters out session or persistent cookies.
	Session bool `js:"session"`
}

type CookiesRemoveCallback

type CookiesRemoveCallback func()

type CookiesSetCallback

type CookiesSetCallback func(Error *js.Object)

type CookiesSetDetails

type CookiesSetDetails struct {
	*js.Object
	// The url to associate the cookie with.
	URL string `js:"url"`
	// The name of the cookie. Empty by default if omitted.
	Name string `js:"name"`
	// The value of the cookie. Empty by default if omitted.
	Value string `js:"value"`
	// The domain of the cookie. Empty by default if omitted.
	Domain string `js:"domain"`
	// The path of the cookie. Empty by default if omitted.
	Path string `js:"path"`
	// Whether the cookie should be marked as Secure. Defaults to false.
	Secure bool `js:"secure"`
	// Whether the cookie should be marked as HTTP only. Defaults to false.
	HttpOnly bool `js:"httpOnly"`
	// The expiration date of the cookie as the number of seconds since the UNIX epoch. If omitted then the cookie becomes a session cookie and will not be retained between sessions.
	ExpirationDate float64 `js:"expirationDate"`
}

type CrashReport

type CrashReport struct {
	*js.Object
	Date string `js:"date"`
	ID   int64  `js:"ID"`
}

CrashReport a Structure

type CrashReporterModule

type CrashReporterModule struct {
	*js.Object
	// You are required to call this method before using any other crashReporter APIs and in each process (main/renderer) from which you want to collect crash reports. You can pass different options to crashReporter.start when calling from different processes. Note: On Windows and Linux, Electron uses breakpad for crash collection and reporting. Crashes can be collected from the main and renderer process, but not from the child processes created via the child_process module. Note: On macOS, Electron uses a new crashpad client for crash collection and reporting. Crashes can be collected from the main, renderer and any of the child processes created via the child_process module. If you want to enable crash reporting, initializing crashpad from the main process using crashReporter.start is required regardless of which process you want to collect crashes from. Once initialized this way, the crashpad handler collects crashes from all processes. You still have to call crashReporter.start from the renderer process, otherwise crashes from renderer processes will get reported without companyName, productName or any of the extra information.
	Start func(Options *CrashReporterModuleStartOptions) `js:"start"`
	// Returns the date and ID of the last crash report. If no crash reports have been sent or the crash reporter has not been started, null is returned.
	GetLastCrashReport func() (Obj *js.Object) `js:"getLastCrashReport"`
	// Returns all uploaded crash reports. Each report contains the date and uploaded ID.
	GetUploadedReports func() (Obj *js.Object) `js:"getUploadedReports"`
	// Note: This API can only be called from the main process.
	GetUploadToServer func() (Obj bool) `js:"getUploadToServer"`
	// This would normally be controlled by user preferences. This has no effect if called before start is called. Note: This API can only be called from the main process.
	SetUploadToServer func(UploadToServer bool) `js:"setUploadToServer"`
}

CrashReporterModule version@1.4.15

Submit crash reports to a remote server.

func GetCrashReporterModule

func GetCrashReporterModule() *CrashReporterModule

type CrashReporterModuleOptionsExtra

type CrashReporterModuleOptionsExtra struct {
	*js.Object
}

type CrashReporterModuleStartOptions

type CrashReporterModuleStartOptions struct {
	*js.Object
	CompanyName string `js:"companyName"`
	// URL that crash reports will be sent to as POST.
	SubmitURL string `js:"submitURL"`
	// Defaults to .
	ProductName string `js:"productName"`
	// Whether crash reports should be sent to the server Default is .
	UploadToServer bool `js:"uploadToServer"`
	// Default is .
	IgnoreSystemCrashHandler bool `js:"ignoreSystemCrashHandler"`
	// An object you can define that will be sent along with the report. Only string properties are sent correctly, Nested objects are not supported.
	Extra *CrashReporterModuleOptionsExtra `js:"extra"`
}

type Debugger

type Debugger struct {
	*events.Emitter
	// Attaches the debugger to the webContents.
	Attach     func(ProtocolVersion string) `js:"attach"`
	IsAttached func() (Obj bool)            `js:"isAttached"`
	// Detaches the debugger from the webContents.
	Detach func() `js:"detach"`
	// Send given command to the debugging target.
	SendCommand func(Method string, CommandParams *DebuggerSendCommandCommandParams, Callback DebuggerSendCommandCallback) `js:"sendCommand"`
}

Debugger version@1.4.15

An alternate transport for Chrome's remote debugging protocol.

func WrapDebugger

func WrapDebugger(o *js.Object) *Debugger

type DebuggerCallbackError

type DebuggerCallbackError struct {
	*js.Object
}

type DebuggerSendCommandCallback

type DebuggerSendCommandCallback func(
	Error *DebuggerCallbackError,
	Result *js.Object)

type DebuggerSendCommandCommandParams

type DebuggerSendCommandCommandParams struct {
	*js.Object
}

type DesktopCapturerModule

type DesktopCapturerModule struct {
	*js.Object
	// Starts gathering information about all available desktop media sources, and calls callback(error, sources) when finished. sources is an array of DesktopCapturerSource objects, each DesktopCapturerSource represents a screen or an individual window that can be captured.
	GetSources func(Options *DesktopCapturerModuleGetSourcesOptions, Callback DesktopCapturerModuleGetSourcesCallback) `js:"getSources"`
}

DesktopCapturerModule version@1.4.15

Access information about media sources that can be used to capture audio and video from the desktop using the navigator.webkitGetUserMedia API.

func GetDesktopCapturerModule

func GetDesktopCapturerModule() *DesktopCapturerModule

type DesktopCapturerModuleGetSourcesCallback

type DesktopCapturerModuleGetSourcesCallback func(Error *js.Object, Sources *js.Object)

type DesktopCapturerModuleGetSourcesOptions

type DesktopCapturerModuleGetSourcesOptions struct {
	*js.Object
	// An array of Strings that lists the types of desktop sources to be captured, available types are and .
	Types *js.Object `js:"types"`
	// The suggested size that the media source thumbnail should be scaled to, defaults to .
	ThumbnailSize *DesktopCapturerModuleOptionsThumbnailSize `js:"thumbnailSize"`
}

type DesktopCapturerModuleOptionsThumbnailSize

type DesktopCapturerModuleOptionsThumbnailSize struct {
	*js.Object
}

type DesktopCapturerSource

type DesktopCapturerSource struct {
	*js.Object
	// The identifier of a window or screen that can be used as a constraint when calling []. The format of the identifier will be or , where is a random generated number.
	Id string `js:"id"`
	// A screen source will be named either or , while the name of a window source will match the window title.
	Name string `js:"name"`
	// A thumbnail image. There is no guarantee that the size of the thumbnail is the same as the specified in the passed to . The actual size depends on the scale of the screen or window.
	Thumbnail *NativeImage `js:"thumbnail"`
}

DesktopCapturerSource a Structure

type DialogModule

type DialogModule struct {
	*js.Object
	// The browserWindow argument allows the dialog to attach itself to a parent window, making it modal. The filters specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. For example: The extensions array should contain extensions without wildcards or dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use the '*' wildcard (no other wildcard is supported). If a callback is passed, the API call will be asynchronous and the result will be passed via callback(filenames) Note: On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown.
	ShowOpenDialog func(BrowserWindow *BrowserWindow, Options *DialogModuleShowOpenDialogOptions, Callback DialogModuleShowOpenDialogCallback) (Obj *js.Object) `js:"showOpenDialog"`
	// The browserWindow argument allows the dialog to attach itself to a parent window, making it modal. The filters specifies an array of file types that can be displayed, see dialog.showOpenDialog for an example. If a callback is passed, the API call will be asynchronous and the result will be passed via callback(filename)
	ShowSaveDialog func(BrowserWindow *BrowserWindow, Options *DialogModuleShowSaveDialogOptions, Callback DialogModuleShowSaveDialogCallback) (Obj string) `js:"showSaveDialog"`
	// Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button. The browserWindow argument allows the dialog to attach itself to a parent window, making it modal. If a callback is passed, the API call will be asynchronous and the result will be passed via callback(response).
	ShowMessageBox func(BrowserWindow *BrowserWindow, Options *DialogModuleShowMessageBoxOptions, Callback DialogModuleShowMessageBoxCallback) (Obj int64) `js:"showMessageBox"`
	// Displays a modal dialog that shows an error message. This API can be called safely before the ready event the app module emits, it is usually used to report errors in early stage of startup.  If called before the app readyevent on Linux, the message will be emitted to stderr, and no GUI dialog will appear.
	ShowErrorBox func(Title string, Content string) `js:"showErrorBox"`
}

DialogModule version@1.4.15

Display native system dialogs for opening and saving files, alerting, etc.

func GetDialogModule

func GetDialogModule() *DialogModule

func (*DialogModule) ShowMessageBoxEx

func (d *DialogModule) ShowMessageBoxEx(opt DialogOptionMessage, bw ...*BrowserWindow) (buttonIndex int)

ShowMessageBoxEx dialog.showMessageBox([browserWindow, ]options[, callback]) browserWindow BrowserWindow (optional) options Object

type String (optional) - Can be "none", "info", "error", "question" or "warning". On Windows, “question” displays the same icon as “info”, unless you set an icon using the “icon” option.
buttons String[] (optional) - Array of texts for buttons. On Windows, an empty array will result in one button labeled “OK”.
defaultId Integer (optional) - Index of the button in the buttons array which will be selected by default when the message box opens.
title String (optional) - Title of the message box, some platforms will not show it.
message String - Content of the message box.
detail String (optional) - Extra information of the message.
icon NativeImage (optional)
cancelId Integer (optional) - The value will be returned when user cancels the dialog instead of clicking the buttons of the dialog. By default it is the index of the buttons that have “cancel” or “no” as label, or 0 if there is no such buttons. On macOS and Windows the index of the “Cancel” but	ton will always be used as cancelId even if it is specified.
noLink Boolean (optional) - On Windows Electron will try to figure out which one of the buttons are common buttons (like “Cancel” or “Yes”), and show the others as command links in the dialog. This can make the dialog appear in the style of modern Windows apps. If you don’t like this behavior, you can set noLink to true.

callback Function (optional)

response Number - The index of the button that was clicked

Returns Integer, the index of the clicked button, if a callback is provided it returns undefined.

Shows a message box, it will block the process until the message box is closed. It returns the index of the clicked button.

The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.

If a callback is passed, the API call will be asynchronous and the result will be passed via callback(response).

func (*DialogModule) ShowMessageEx

func (d *DialogModule) ShowMessageEx(title, msg string)

ExShowMessage easy form for ShowMessageBox

func (*DialogModule) ShowOpenDialogEx

func (d *DialogModule) ShowOpenDialogEx(opt DialogOptionOpen, bw ...*BrowserWindow) (filePaths []string)

ShowOpenDialogEx ([browserWindow, ]options[, callback]) browserWindow BrowserWindow (optional) options Object

title String (optional)
defaultPath String (optional)
buttonLabel String (optional) - Custom label for the confirmation button, when left empty the default label will be used.
filters FileFilterEx[] (optional)
properties String[] (optional) - Contains which features the dialog should use, can contain openFile, openDirectory, multiSelections, createDirectory and showHiddenFiles.
normalizeAccessKeys Boolean (optional) - Normalize the keyboard access keys across platforms. Default is false. Enabling this assumes & is used in the button labels for the placement of the keyboard shortcut access key and labels will be converted so they work correctly on each platform, & characters are removed on macOS, converted to _ on Linux, and left untouched on Windows. For example, a button label of Vie&w will be converted to Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and Linux.

callback Function (optional)

filePaths String[] - An array of file paths chosen by the user

Returns String[], an array of file paths chosen by the user, if the callback is provided it returns undefined.

The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.

The filters specifies an array of file types that can be displayed or selected when you want to limit the user to a specific type. For example:

{
  filters: [
    {name: 'Images', extensions: ['jpg', 'png', 'gif']},
    {name: 'Movies', extensions: ['mkv', 'avi', 'mp4']},
    {name: 'Custom File Type', extensions: ['as']},
    {name: 'All Files', extensions: ['*']}
  ]
}

The extensions array should contain extensions without wildcards or dots (e.g. 'png' is good but '.png' and '*.png' are bad). To show all files, use the '*' wildcard (no other wildcard is supported).

If a callback is passed, the API call will be asynchronous and the result will be passed via callback(filenames)

Note: On Windows and Linux an open dialog can not be both a file selector and a directory selector, so if you set properties to ['openFile', 'openDirectory'] on these platforms, a directory selector will be shown.

func (*DialogModule) ShowSaveDialogEx

func (d *DialogModule) ShowSaveDialogEx(opt DialogOptionSave, bw ...*BrowserWindow) (filepath string)

ShowSaveDialogEx dialog.showSaveDialog([browserWindow, ]options[, callback]) browserWindow BrowserWindow (optional) options Object

title String (optional)
defaultPath String (optional)
buttonLabel String (optional) - Custom label for the confirmation button, when left empty the default label will be used.
filters FileFilterEx[] (optional)

callback Function (optional)

filename String

Returns String, the path of the file chosen by the user, if a callback is provided it returns undefined.

The browserWindow argument allows the dialog to attach itself to a parent window, making it modal.

The filters specifies an array of file types that can be displayed, see dialog.showOpenDialog for an example.

If a callback is passed, the API call will be asynchronous and the result will be passed via callback(filename)

type DialogModuleShowMessageBoxCallback

type DialogModuleShowMessageBoxCallback func(
	Response float64)

type DialogModuleShowMessageBoxOptions

type DialogModuleShowMessageBoxOptions struct {
	*js.Object
	// Can be , , , or . On Windows, "question" displays the same icon as "info", unless you set an icon using the "icon" option.
	Type string `js:"type"`
	// Array of texts for buttons. On Windows, an empty array will result in one button labeled "OK".
	Buttons *js.Object `js:"buttons"`
	// Index of the button in the buttons array which will be selected by default when the message box opens.
	DefaultId int64 `js:"defaultId"`
	// Title of the message box, some platforms will not show it.
	Title string `js:"title"`
	// Content of the message box.
	Message string `js:"message"`
	// Extra information of the message.
	Detail string       `js:"detail"`
	Icon   *NativeImage `js:"icon"`
	// The value will be returned when user cancels the dialog instead of clicking the buttons of the dialog. By default it is the index of the buttons that have "cancel" or "no" as label, or 0 if there is no such buttons. On macOS and Windows the index of the "Cancel" button will always be used as even if it is specified.
	CancelId int64 `js:"cancelId"`
	// On Windows Electron will try to figure out which one of the are common buttons (like "Cancel" or "Yes"), and show the others as command links in the dialog. This can make the dialog appear in the style of modern Windows apps. If you don't like this behavior, you can set to .
	NoLink bool `js:"noLink"`
}

type DialogModuleShowOpenDialogCallback

type DialogModuleShowOpenDialogCallback func(
	FilePaths *js.Object)

type DialogModuleShowOpenDialogOptions

type DialogModuleShowOpenDialogOptions struct {
	*js.Object
	Title       string `js:"title"`
	DefaultPath string `js:"defaultPath"`
	// Custom label for the confirmation button, when left empty the default label will be used.
	ButtonLabel string     `js:"buttonLabel"`
	Filters     *js.Object `js:"filters"`
	// Contains which features the dialog should use, can contain , , , and .
	Properties *js.Object `js:"properties"`
	// Normalize the keyboard access keys across platforms. Default is . Enabling this assumes is used in the button labels for the placement of the keyboard shortcut access key and labels will be converted so they work correctly on each platform, characters are removed on macOS, converted to on Linux, and left untouched on Windows. For example, a button label of will be converted to on Linux and on macOS and can be selected via on Windows and Linux.
	NormalizeAccessKeys bool `js:"normalizeAccessKeys"`
}

type DialogModuleShowSaveDialogCallback

type DialogModuleShowSaveDialogCallback func(Filename string)

type DialogModuleShowSaveDialogOptions

type DialogModuleShowSaveDialogOptions struct {
	*js.Object
	Title       string `js:"title"`
	DefaultPath string `js:"defaultPath"`
	// Custom label for the confirmation button, when left empty the default label will be used.
	ButtonLabel string     `js:"buttonLabel"`
	Filters     *js.Object `js:"filters"`
}

type DialogOptionMessage

type DialogOptionMessage struct {
	Type      string       // type String (optional) - Can be "none", "info", "error", "question" or "warning". On Windows, “question” displays the same icon as “info”, unless you set an icon using the “icon” option.
	Buttons   []string     // buttons String[] (optional) - Array of texts for buttons. On Windows, an empty array will result in one button labeled “OK”.
	DefaultID int          // defaultId Integer (optional) - Index of the button in the buttons array which will be selected by default when the message box opens.
	Title     string       // title String (optional) - Title of the message box, some platforms will not show it.
	Message   string       // message String - Content of the message box.
	Detail    string       // detail String (optional) - Extra information of the message.
	Icon      *NativeImage // icon NativeImage (optional)
	CancelID  int          // cancelId Integer (optional) - The value will be returned when user cancels the dialog instead of clicking the buttons of the dialog. By default it is the index of the buttons that have “cancel” or “no” as label, or 0 if there is no such buttons. On macOS and Windows the index of the “Cancel” button will always be used as cancelId even if it is specified.
	NoLink    bool         // noLink Boolean (optional) - On Windows Electron will try to figure out which one of the buttons are common buttons (like “Cancel” or “Yes”), and show the others as command links in the dialog. This can make the dialog appear in the style of modern Windows apps. If you don’t like this behavior, you can set noLink to true.
}

DialogOptionMessage options

type DialogOptionOpen

type DialogOptionOpen struct {
	Title       string         // title String (optional)
	DefaultPath string         // defaultPath String (optional)
	ButtonLabel string         // buttonLabel String (optional) - Custom label for the confirmation button, when left empty the default label will be used.
	Filters     []FileFilterEx // filters FileFilterEx[] (optional)
	Properties  []string       // properties String[] (optional) - Contains which features the dialog should use, can contain openFile, openDirectory, multiSelections, createDirectory and showHiddenFiles.
	// normalizeAccessKeys Boolean (optional) - Normalize the keyboard access keys across platforms.
	// Default is false. Enabling this assumes & is used in the button labels for the placement of
	// the keyboard shortcut access key and labels will be converted so they work correctly on
	// each platform, & characters are removed on macOS, converted to _ on Linux, and
	// left untouched on Windows. For example, a button label of Vie&w will be converted to
	// Vie_w on Linux and View on macOS and can be selected via Alt-W on Windows and Linux.
	NormalizeAccessKeys bool
}

DialogOptionOpen wraps the dialog creating options

type DialogOptionSave

type DialogOptionSave struct {
	Title       string         // title String (optional)
	DefaultPath string         // defaultPath String (optional)
	ButtonLabel string         // buttonLabel String (optional) - Custom label for the confirmation button, when left empty the default label will be used.
	Filters     []FileFilterEx // filters FileFilterEx[] (optional)
}

DialogOptionSave wraps for ShowSaveDialog

type Display

type Display struct {
	*js.Object
	// Unique identifier associated with the display.
	Id float64 `js:"id"`
	// Can be 0, 90, 180, 270, represents screen rotation in clock-wise degrees.
	Rotation float64 `js:"rotation"`
	// Output device's pixel scale factor.
	ScaleFactor float64 `js:"scaleFactor"`
	// Can be , , .
	TouchSupport DisplayDisplayTouchSupport  `js:"touchSupport"`
	Bounds       *js.Object                  `js:"bounds"`
	Size         *DisplayDisplaySize         `js:"size"`
	WorkArea     *js.Object                  `js:"workArea"`
	WorkAreaSize *DisplayDisplayWorkAreaSize `js:"workAreaSize"`
}

Display a Structure

type DisplayDisplaySize

type DisplayDisplaySize struct {
	*js.Object
	Height float64 `js:"height"`
	Width  float64 `js:"width"`
}

type DisplayDisplayTouchSupport

type DisplayDisplayTouchSupport string
const (
	DisplayDisplayTouchSupportAvailable   DisplayDisplayTouchSupport = "available"
	DisplayDisplayTouchSupportUnavailable DisplayDisplayTouchSupport = "unavailable"
	DisplayDisplayTouchSupportUnknown     DisplayDisplayTouchSupport = "unknown"
)

consts

type DisplayDisplayWorkAreaSize

type DisplayDisplayWorkAreaSize struct {
	*js.Object
	Height float64 `js:"height"`
	Width  float64 `js:"width"`
}

type DownloadItem

type DownloadItem struct {
	*events.Emitter
	// The API is only available in session's will-download callback function. If user doesn't set the save path via the API, Electron will use the original routine to determine the save path(Usually prompts a save dialog).
	SetSavePath func(Path string)   `js:"setSavePath"`
	GetSavePath func() (Obj string) `js:"getSavePath"`
	// Pauses the download.
	Pause    func()            `js:"pause"`
	IsPaused func() (Obj bool) `js:"isPaused"`
	// Resumes the download that has been paused.
	Resume func() `js:"resume"`
	// Resumes Boolean - Whether the download can resume.
	CanResume func() `js:"canResume"`
	// Cancels the download operation.
	Cancel         func()              `js:"cancel"`
	GetURL         func() (Obj string) `js:"getURL"`
	GetMimeType    func() (Obj string) `js:"getMimeType"`
	HasUserGesture func() (Obj bool)   `js:"hasUserGesture"`
	// Note: The file name is not always the same as the actual one saved in local disk. If user changes the file name in a prompted download saving dialog, the actual name of saved file will be different.
	GetFilename func() (Obj string) `js:"getFilename"`
	// If the size is unknown, it returns 0.
	GetTotalBytes         func() (Obj int64)  `js:"getTotalBytes"`
	GetReceivedBytes      func() (Obj int64)  `js:"getReceivedBytes"`
	GetContentDisposition func() (Obj string) `js:"getContentDisposition"`
	// Note: The following methods are useful specifically to resume a cancelled item when session is restarted.
	GetState            func() (Obj string)     `js:"getState"`
	GetURLChain         func() (Obj *js.Object) `js:"getURLChain"`
	GetLastModifiedTime func() (Obj string)     `js:"getLastModifiedTime"`
	GetETag             func() (Obj string)     `js:"getETag"`
	GetStartTime        func() (Obj float64)    `js:"getStartTime"`
}

DownloadItem version@1.4.15

Control file downloads from remote sources.

func WrapDownloadItem

func WrapDownloadItem(o *js.Object) *DownloadItem

type FileFilter

type FileFilter struct {
	*js.Object
	Name       string     `js:"name"`
	Extensions *js.Object `js:"extensions"`
}

FileFilter a Structure

type FileFilterEx

type FileFilterEx struct {
	Name       string   // name String
	Extensions []string // extensions String[]
}

FileFilterEx wraps

type GlobalShortcutModule

type GlobalShortcutModule struct {
	*js.Object
	// Registers a global shortcut of accelerator. The callback is called when the registered shortcut is pressed by the user. When the accelerator is already taken by other applications, this call will silently fail. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts.
	Register func(Accelerator *js.Object, Callback GlobalShortcutModuleRegisterCallback) `js:"register"`
	// When the accelerator is already taken by other applications, this call will still return false. This behavior is intended by operating systems, since they don't want applications to fight for global shortcuts.
	IsRegistered func(Accelerator *js.Object) (Obj bool) `js:"isRegistered"`
	// Unregisters the global shortcut of accelerator.
	Unregister func(Accelerator *js.Object) `js:"unregister"`
	// Unregisters all of the global shortcuts.
	UnregisterAll func() `js:"unregisterAll"`
}

GlobalShortcutModule version@1.4.15

Detect keyboard events when the application does not have keyboard focus.

func GetGlobalShortcutModule

func GetGlobalShortcutModule() *GlobalShortcutModule

type GlobalShortcutModuleRegisterCallback

type GlobalShortcutModuleRegisterCallback func()

type IncomingMessage

type IncomingMessage struct {
	*events.Emitter
	// An Integer indicating the HTTP response status code.
	StatusCode int64 `js:"statusCode"`
	// A String representing the HTTP status message.
	StatusMessage string `js:"statusMessage"`
	// An Object representing the response HTTP headers. The headers object is formatted as follows:
	Headers *IncomingMessageIncomingMessageHeaders `js:"headers"`
	// A String indicating the HTTP protocol version number. Typical values are '1.0' or '1.1'. Additionally httpVersionMajor and httpVersionMinor are two Integer-valued readable properties that return respectively the HTTP major and minor version numbers.
	HttpVersion string `js:"httpVersion"`
	// An Integer indicating the HTTP protocol major version number.
	HttpVersionMajor int64 `js:"httpVersionMajor"`
	// An Integer indicating the HTTP protocol minor version number.
	HttpVersionMinor int64 `js:"httpVersionMinor"`
}

IncomingMessage version@1.4.15

Handle responses to HTTP/HTTPS requests.

func WrapIncomingMessage

func WrapIncomingMessage(o *js.Object) *IncomingMessage

type IncomingMessageIncomingMessageHeaders

type IncomingMessageIncomingMessageHeaders struct {
	*js.Object
}

type IpcMainModule

type IpcMainModule struct {
	*js.Object
	// Listens to channel, when a new message arrives listener would be called with listener(event, args...).
	On func(Channel string, Listener IpcMainModuleOnListener) `js:"on"`
	// Adds a one time listener function for the event. This listener is invoked only the next time a message is sent to channel, after which it is removed.
	Once func(Channel string, Listener IpcMainModuleOnceListener) `js:"once"`
	// Removes the specified listener from the listener array for the specified channel.
	RemoveListener func(Channel string, Listener IpcMainModuleRemoveListenerListener) `js:"removeListener"`
	// Removes all listeners, or those of the specified channel.
	RemoveAllListeners func(Channel string) `js:"removeAllListeners"`
}

IpcMainModule version@1.4.15

Communicate asynchronously from the main process to renderer processes.

func GetIpcMainModule

func GetIpcMainModule() *IpcMainModule

type IpcMainModuleOnListener

type IpcMainModuleOnListener func()

type IpcMainModuleOnceListener

type IpcMainModuleOnceListener func()

type IpcMainModuleRemoveListenerListener

type IpcMainModuleRemoveListenerListener func()

type IpcRendererModule

type IpcRendererModule struct {
	*js.Object
	// Listens to channel, when a new message arrives listener would be called with listener(event, args...).
	On func(Channel string, Listener IpcRendererModuleOnListener) `js:"on"`
	// Adds a one time listener function for the event. This listener is invoked only the next time a message is sent to channel, after which it is removed.
	Once func(Channel string, Listener IpcRendererModuleOnceListener) `js:"once"`
	// Removes the specified listener from the listener array for the specified channel.
	RemoveListener func(Channel string, Listener IpcRendererModuleRemoveListenerListener) `js:"removeListener"`
	// Removes all listeners, or those of the specified channel.
	RemoveAllListeners func(Channel string) `js:"removeAllListeners"`
	// Send a message to the main process asynchronously via channel, you can also send arbitrary arguments. Arguments will be serialized in JSON internally and hence no functions or prototype chain will be included. The main process handles it by listening for channel with ipcMain module.
	Send func(Channel string, Args *js.Object) `js:"send"`
	// Send a message to the main process synchronously via channel, you can also send arbitrary arguments. Arguments will be serialized in JSON internally and hence no functions or prototype chain will be included. The main process handles it by listening for channel with ipcMain module, and replies by setting event.returnValue. Note: Sending a synchronous message will block the whole renderer process, unless you know what you are doing you should never use it.
	SendSync func(Channel string, Args *js.Object) `js:"sendSync"`
	// Like ipcRenderer.send but the event will be sent to the  element in the host page instead of the main process.
	SendToHost func(Channel string, Args *js.Object) `js:"sendToHost"`
}

IpcRendererModule version@1.4.15

Communicate asynchronously from a renderer process to the main process.

func GetIpcRendererModule

func GetIpcRendererModule() *IpcRendererModule

type IpcRendererModuleOnListener

type IpcRendererModuleOnListener func()

type IpcRendererModuleOnceListener

type IpcRendererModuleOnceListener func()

type IpcRendererModuleRemoveListenerListener

type IpcRendererModuleRemoveListenerListener func()

type JumpListCategory

type JumpListCategory struct {
	*js.Object
	// One of the following:
	Type JumpListCategoryJumpListCategoryType `js:"type"`
	// Must be set if is , otherwise it should be omitted.
	Name string `js:"name"`
	// Array of objects if is or , otherwise it should be omitted.
	Items *js.Object `js:"items"`
}

JumpListCategory a Structure

type JumpListCategoryJumpListCategoryType

type JumpListCategoryJumpListCategoryType string
const (
	JumpListCategoryJumpListCategoryTypeTasks    JumpListCategoryJumpListCategoryType = "tasks"
	JumpListCategoryJumpListCategoryTypeFrequent JumpListCategoryJumpListCategoryType = "frequent"
	JumpListCategoryJumpListCategoryTypeRecent   JumpListCategoryJumpListCategoryType = "recent"
	JumpListCategoryJumpListCategoryTypeCustom   JumpListCategoryJumpListCategoryType = "custom"
)

consts

type JumpListItem

type JumpListItem struct {
	*js.Object
	// One of the following:
	Type JumpListItemJumpListItemType `js:"type"`
	// Path of the file to open, should only be set if is .
	Path string `js:"path"`
	// Path of the program to execute, usually you should specify which opens the current program. Should only be set if is .
	Program string `js:"program"`
	// The command line arguments when is executed. Should only be set if is .
	Args string `js:"args"`
	// The text to be displayed for the item in the Jump List. Should only be set if is .
	Title string `js:"title"`
	// Description of the task (displayed in a tooltip). Should only be set if is .
	Description string `js:"description"`
	// The absolute path to an icon to be displayed in a Jump List, which can be an arbitrary resource file that contains an icon (e.g. , , ). You can usually specify to show the program icon.
	IconPath string `js:"iconPath"`
	// The index of the icon in the resource file. If a resource file contains multiple icons this value can be used to specify the zero-based index of the icon that should be displayed for this task. If a resource file contains only one icon, this property should be set to zero.
	IconIndex float64 `js:"iconIndex"`
}

JumpListItem a Structure

type JumpListItemJumpListItemType

type JumpListItemJumpListItemType string
const (
	JumpListItemJumpListItemTypeTask      JumpListItemJumpListItemType = "task"
	JumpListItemJumpListItemTypeSeparator JumpListItemJumpListItemType = "separator"
	JumpListItemJumpListItemTypeFile      JumpListItemJumpListItemType = "file"
)

consts

type MemoryUsageDetails

type MemoryUsageDetails struct {
	*js.Object
	Count         float64 `js:"count"`
	Size          float64 `js:"size"`
	LiveSize      float64 `js:"liveSize"`
	DecodedSize   float64 `js:"decodedSize"`
	PurgedSize    float64 `js:"purgedSize"`
	PurgeableSize float64 `js:"purgeableSize"`
}

MemoryUsageDetails a Structure

type Menu struct {
	*js.Object
	// A MenuItem[] array containing the menu's items. Each Menu consists of multiple MenuItems and each MenuItem can have a submenu.
	Items *js.Object `js:"items"`
	// Pops up this menu as a context menu in the browserWindow.
	Popup func(BrowserWindow *BrowserWindow, X float64, Y float64, PositioningItem float64) `js:"popup"`
	// Appends the menuItem to the menu.
	Append func(MenuItem *MenuItem) `js:"append"`
	// Inserts the menuItem to the pos position of the menu.
	Insert func(Pos int64, MenuItem *MenuItem) `js:"insert"`
}

Menu version@1.4.15

Create native application menus and context menus.

func BuildFromTemplateEx

func BuildFromTemplateEx(opts []MenuItemOptionEx) *Menu

Menu.buildFromTemplate(template) template MenuItemConstructorOptions[] Returns Menu Generally, the template is just an array of options for constructing a MenuItem. The usage can be referenced above. You can also attach other fields to the element of the template and they will become properties of the constructed menu items.

!!! You can use the go style struct literal here

func NewMenu

func NewMenu() *Menu

func WrapMenu

func WrapMenu(o *js.Object) *Menu
type MenuItem struct {
	*js.Object
	// A Boolean indicating whether the item is enabled, this property can be dynamically changed.
	Enabled bool `js:"enabled"`
	// A Boolean indicating whether the item is visible, this property can be dynamically changed.
	Visible bool `js:"visible"`
	// A Boolean indicating whether the item is checked, this property can be dynamically changed. A checkbox menu item will toggle the checked property on and off when selected. A radio menu item will turn on its checked property when clicked, and will turn off that property for all adjacent items in the same menu. You can add a click function for additional behavior.
	Checked bool `js:"checked"`
	// A String representing the menu items visible label
	Label string `js:"label"`
	// A Function that is fired when the MenuItem recieves a click event
	Click MenuItemMenuItemClick `js:"click"`
}

MenuItem version@1.4.15

Add items to native application menus and context menus.

func NewItemEx

func NewItemEx(opt MenuItemOptionEx) *MenuItem

func NewMenuItem

func NewMenuItem(Options *MenuItemMenuItemOptions) *MenuItem

func WrapMenuItem

func WrapMenuItem(o *js.Object) *MenuItem
type MenuItemMenuItemClick func()
type MenuItemMenuItemOptions struct {
	*js.Object
	// Will be called with when the menu item is clicked.
	Click MenuItemOptionsClick `js:"click"`
	// Define the action of the menu item, when specified the property will be ignored.
	Role string `js:"role"`
	// Can be , , , or .
	Type MenuItemOptionsType `js:"type"`
	// (optional)
	Label string `js:"label"`
	// (optional)
	Sublabel    string       `js:"sublabel"`
	Accelerator *js.Object   `js:"accelerator"`
	Icon        *NativeImage `js:"icon"`
	// If false, the menu item will be greyed out and unclickable.
	Enabled bool `js:"enabled"`
	// If false, the menu item will be entirely hidden.
	Visible bool `js:"visible"`
	// Should only be specified for or type menu items.
	Checked bool `js:"checked"`
	// Should be specified for type menu items. If is specified, the can be omitted. If the value is not a then it will be automatically converted to one using .
	Submenu *js.Object `js:"submenu"`
	// Unique within a single menu. If defined then it can be used as a reference to this item by the position attribute.
	Id string `js:"id"`
	// This field allows fine-grained definition of the specific location within a given menu.
	Position string `js:"position"`
}
type MenuItemOptionEx struct {
	// *js.Object
	// click Function (optional) - Will be called with click(menuItem, browserWindow, event)
	// when the menu item is clicked.
	//  menuItem MenuItem
	//  browserWindow BrowserWindow
	//  event Event
	// Click func(item *Item, w *browserwindow.BrowserWindow, event *js.Object) `js:"click"`
	Click   func()
	ClickEx func(item *MenuItem)
	// role String (optional) - Define the action of the menu item,
	//      when specified the click property will be ignored.
	Role string
	// type String (optional) - Can be normal, separator, submenu, checkbox or radio.
	Type string
	// label String - (optional)
	Label string
	// sublabel String - (optional)
	Sublabel string
	// accelerator Accelerator (optional)
	// icon (NativeImage | String) (optional)
	Icon *NativeImage
	// enabled Boolean (optional) - If false, the menu item will be greyed out and unclickable.
	Enabled bool
	// visible Boolean (optional) - If false, the menu item will be entirely hidden.
	Visible bool
	// checked Boolean (optional) - Should only be specified for checkbox or radio type menu items.
	Checked bool
	// submenu (MenuItemConstructorOptions[] | Menu) (optional) -
	//      Should be specified for submenu type menu items.
	//      If submenu is specified, the type: 'submenu' can be omitted.
	//      If the value is not a Menu then it will be automatically converted to one using Menu.buildFromTemplate.
	SubMenuOptions []MenuItemOptionEx
	SubMenu        *Menu
	// id String (optional) - Unique within a single menu.
	// If defined then it can be used as a reference to this item by the position attribute.
	ID string
	// position String (optional) - This field allows fine-grained definition of
	// the specific location within a given menu.
	Position string
}
type MenuItemOptionsClick func(MenuItem *MenuItem, BrowserWindow *BrowserWindow, Event *js.Object)
type MenuItemOptionsType string
const (
	MenuItemOptionsTypeNormal    MenuItemOptionsType = "normal"
	MenuItemOptionsTypeSeparator MenuItemOptionsType = "separator"
	MenuItemOptionsTypeSubmenu   MenuItemOptionsType = "submenu"
	MenuItemOptionsTypeCheckbox  MenuItemOptionsType = "checkbox"
	MenuItemOptionsTypeRadio     MenuItemOptionsType = "radio"
)

consts

type MimeTypedBuffer

type MimeTypedBuffer struct {
	*js.Object
	// The mimeType of the Buffer that you are sending
	MimeType string `js:"mimeType"`
	// The actual Buffer content
	Buffer *js.Object `js:"buffer"`
}

MimeTypedBuffer a Structure

type NativeImage

type NativeImage struct {
	*js.Object
	ToPNG     func() (Obj *js.Object)              `js:"toPNG"`
	ToJPEG    func(Quality int64) (Obj *js.Object) `js:"toJPEG"`
	ToBitmap  func() (Obj *js.Object)              `js:"toBitmap"`
	ToDataURL func() (Obj string)                  `js:"toDataURL"`
	// The difference between getBitmap() and toBitmap() is, getBitmap() does not copy the bitmap data, so you have to use the returned Buffer immediately in current event loop tick, otherwise the data might be changed or destroyed.
	GetBitmap func() (Obj *js.Object) `js:"getBitmap"`
	// Notice that the returned pointer is a weak pointer to the underlying native image instead of a copy, so you must ensure that the associated nativeImage instance is kept around.
	GetNativeHandle func() (Obj *js.Object)             `js:"getNativeHandle"`
	IsEmpty         func() (Obj bool)                   `js:"isEmpty"`
	GetSize         func() (Obj *NativeImageGetSizeObj) `js:"getSize"`
	// Marks the image as a template image.
	SetTemplateImage func(Option bool)                                  `js:"setTemplateImage"`
	IsTemplateImage  func() (Obj bool)                                  `js:"isTemplateImage"`
	Crop             func(Rect *NativeImageCropRect) (Obj *NativeImage) `js:"crop"`
	// If only the height or the width are specified then the current aspect ratio will be preserved in the resized image.
	Resize         func(Options *NativeImageResizeOptions) (Obj *NativeImage) `js:"resize"`
	GetAspectRatio func() (Obj float64)                                       `js:"getAspectRatio"`
}

NativeImage version@1.4.15

Natively wrap images such as tray, dock, and application icons.

func WrapNativeImage

func WrapNativeImage(o *js.Object) *NativeImage

type NativeImageCropRect

type NativeImageCropRect struct {
	*js.Object
	X      int64 `js:"x"`
	Y      int64 `js:"y"`
	Width  int64 `js:"width"`
	Height int64 `js:"height"`
}

type NativeImageGetSizeObj

type NativeImageGetSizeObj struct {
	*js.Object
	Width  int64 `js:"width"`
	Height int64 `js:"height"`
}

type NativeImageModule

type NativeImageModule struct {
	*js.Object
	// Creates an empty NativeImage instance.
	CreateEmpty func() (Obj *NativeImage) `js:"createEmpty"`
	// Creates a new NativeImage instance from a file located at path. This method returns an empty image if the path does not exist, cannot be read, or is not a valid image.
	CreateFromPath func(Path string) (Obj *NativeImage) `js:"createFromPath"`
	// Creates a new NativeImage instance from buffer.
	CreateFromBuffer func(Buffer *js.Object, Options *NativeImageModuleCreateFromBufferOptions) (Obj *NativeImage) `js:"createFromBuffer"`
	// Creates a new NativeImage instance from dataURL.
	CreateFromDataURL func(DataURL string) `js:"createFromDataURL"`
}

NativeImageModule version@1.4.15

Create tray, dock, and application icons using PNG or JPG files.

func GetNativeImageModule

func GetNativeImageModule() *NativeImageModule

type NativeImageModuleCreateFromBufferOptions

type NativeImageModuleCreateFromBufferOptions struct {
	*js.Object
	// Required for bitmap buffers.
	Width int64 `js:"width"`
	// Required for bitmap buffers.
	Height int64 `js:"height"`
	// Defaults to 1.0.
	ScaleFactor float64 `js:"scaleFactor"`
}

type NativeImageResizeOptions

type NativeImageResizeOptions struct {
	*js.Object
	Width  int64 `js:"width"`
	Height int64 `js:"height"`
	// The desired quality of the resize image. Possible values are , or . The default is . These values express a desired quality/speed tradeoff. They are translated into an algorithm-specific method that depends on the capabilities (CPU, GPU) of the underlying platform. It is possible for all three methods to be mapped to the same algorithm on a given platform.
	Quality string `js:"quality"`
}

type NetModule

type NetModule struct {
	*js.Object
	// Creates a ClientRequest instance using the provided options which are directly forwarded to the ClientRequest constructor. The net.request method would be used to issue both secure and insecure HTTP requests according to the specified protocol scheme in the options object.
	Request func(Options *NetModuleRequestOptions) (Obj *ClientRequest) `js:"request"`
}

NetModule version@1.4.15

Issue HTTP/HTTPS requests using Chromium's native networking library

func GetNetModule

func GetNetModule() *NetModule

type NetModuleRequestOptions

type NetModuleRequestOptions struct {
	*js.Object
}

type PowerMonitorModule

type PowerMonitorModule struct {
	*events.Emitter
}

PowerMonitorModule version@1.4.15

Monitor power state changes.

func GetPowerMonitorModule

func GetPowerMonitorModule() *PowerMonitorModule

type PowerSaveBlockerModule

type PowerSaveBlockerModule struct {
	*js.Object
	// Starts preventing the system from entering lower-power mode. Returns an integer identifying the power save blocker. Note: prevent-display-sleep has higher precedence over prevent-app-suspension. Only the highest precedence type takes effect. In other words, prevent-display-sleep always takes precedence over prevent-app-suspension. For example, an API calling A requests for prevent-app-suspension, and another calling B requests for prevent-display-sleep. prevent-display-sleep will be used until B stops its request. After that, prevent-app-suspension is used.
	Start func(Type PowerSaveBlockerModuleStartType) (Obj int64) `js:"start"`
	// Stops the specified power save blocker.
	Stop      func(Id int64)            `js:"stop"`
	IsStarted func(Id int64) (Obj bool) `js:"isStarted"`
}

PowerSaveBlockerModule version@1.4.15

Block the system from entering low-power (sleep) mode.

func GetPowerSaveBlockerModule

func GetPowerSaveBlockerModule() *PowerSaveBlockerModule

type PowerSaveBlockerModuleStartType

type PowerSaveBlockerModuleStartType string
const (
	PowerSaveBlockerModuleStartTypePreventAppSuspension PowerSaveBlockerModuleStartType = "prevent-app-suspension"
	PowerSaveBlockerModuleStartTypePreventDisplaySleep  PowerSaveBlockerModuleStartType = "prevent-display-sleep"
)

consts

type ProcessModule

type ProcessModule struct {
	*events.Emitter
	// Setting this to true can disable the support for asar archives in Node's built-in modules.
	NoAsar string `js:"noAsar"`
	// Current process's type, can be "browser" (i.e. main process) or "renderer".
	Type string `js:"type"`
	// Electron's version string.
	Electron string `js:"electron"`
	// Chrome's version string.
	Chrome string `js:"chrome"`
	// Path to the resources directory.
	ResourcesPath string `js:"resourcesPath"`
	// For Mac App Store build, this property is true, for other builds it is undefined.
	Mas string `js:"mas"`
	// If the app is running as a Windows Store app (appx), this property is true, for otherwise it is undefined.
	WindowsStore string `js:"windowsStore"`
	// When app is started by being passed as parameter to the default app, this property is true in the main process, otherwise it is undefined.
	DefaultApp string `js:"defaultApp"`
	// Causes the main thread of the current process crash.
	Crash func() `js:"crash"`
	// Causes the main thread of the current process hang.
	Hang func() `js:"hang"`
	// Sets the file descriptor soft limit to maxDescriptors or the OS hard limit, whichever is lower for the current process.
	SetFdLimit func(MaxDescriptors int64) `js:"setFdLimit"`
	// Returns an object giving memory usage statistics about the current process. Note that all statistics are reported in Kilobytes.
	GetProcessMemoryInfo func() (Obj *ProcessModuleGetProcessMemoryInfoObj) `js:"getProcessMemoryInfo"`
	// Returns an object giving memory usage statistics about the entire system. Note that all statistics are reported in Kilobytes.
	GetSystemMemoryInfo func() (Obj *ProcessModuleGetSystemMemoryInfoObj) `js:"getSystemMemoryInfo"`
}

ProcessModule version@1.4.15

Extensions to process object.

func GetProcessModule

func GetProcessModule() *ProcessModule

type ProcessModuleGetProcessMemoryInfoObj

type ProcessModuleGetProcessMemoryInfoObj struct {
	*js.Object
	// The amount of memory currently pinned to actual physical RAM.
	WorkingSetSize int64 `js:"workingSetSize"`
	// The maximum amount of memory that has ever been pinned to actual physical RAM.
	PeakWorkingSetSize int64 `js:"peakWorkingSetSize"`
	// The amount of memory not shared by other processes, such as JS heap or HTML content.
	PrivateBytes int64 `js:"privateBytes"`
	// The amount of memory shared between processes, typically memory consumed by the Electron code itself
	SharedBytes int64 `js:"sharedBytes"`
}

type ProcessModuleGetSystemMemoryInfoObj

type ProcessModuleGetSystemMemoryInfoObj struct {
	*js.Object
	// The total amount of physical memory in Kilobytes available to the system.
	Total int64 `js:"total"`
	// The total amount of memory not being used by applications or disk cache.
	Free int64 `js:"free"`
	// The total amount of swap memory in Kilobytes available to the system.
	SwapTotal int64 `js:"swapTotal"`
	// The free amount of swap memory in Kilobytes available to the system.
	SwapFree int64 `js:"swapFree"`
}

type ProtocolModule

type ProtocolModule struct {
	*js.Object
	// A standard scheme adheres to what RFC 3986 calls generic URI syntax. For example http and https are standard schemes, while file is not. Registering a scheme as standard, will allow relative and absolute resources to be resolved correctly when served. Otherwise the scheme will behave like the file protocol, but without the ability to resolve relative URLs. For example when you load following page with custom protocol without registering it as standard scheme, the image will not be loaded because non-standard schemes can not recognize relative URLs: Registering a scheme as standard will allow access to files through the FileSystem API. Otherwise the renderer will throw a security error for the scheme. By default web storage apis (localStorage, sessionStorage, webSQL, indexedDB, cookies) are disabled for non standard schemes. So in general if you want to register a custom protocol to replace the http protocol, you have to register it as a standard scheme: Note: This method can only be used before the ready event of the app module gets emitted.
	RegisterStandardSchemes      func(Schemes *js.Object, Options *ProtocolModuleRegisterStandardSchemesOptions) `js:"registerStandardSchemes"`
	RegisterServiceWorkerSchemes func(Schemes *js.Object)                                                        `js:"registerServiceWorkerSchemes"`
	// Registers a protocol of scheme that will send the file as a response. The handler will be called with handler(request, callback) when a request is going to be created with scheme. completion will be called with completion(null) when scheme is successfully registered or completion(error) when failed. To handle the request, the callback should be called with either the file's path or an object that has a path property, e.g. callback(filePath) or callback({path: filePath}). When callback is called with nothing, a number, or an object that has an error property, the request will fail with the error number you specified. For the available error numbers you can use, please see the net error list. By default the scheme is treated like http:, which is parsed differently than protocols that follow the "generic URI syntax" like file:, so you probably want to call protocol.registerStandardSchemes to have your scheme treated as a standard scheme.
	RegisterFileProtocol func(Scheme string, Handler ProtocolModuleRegisterFileProtocolHandler, Completion ProtocolModuleRegisterFileProtocolCompletion) `js:"registerFileProtocol"`
	// Registers a protocol of scheme that will send a Buffer as a response. The usage is the same with registerFileProtocol, except that the callback should be called with either a Buffer object or an object that has the data, mimeType, and charset properties. Example:
	RegisterBufferProtocol func(Scheme string, Handler ProtocolModuleRegisterBufferProtocolHandler, Completion ProtocolModuleRegisterBufferProtocolCompletion) `js:"registerBufferProtocol"`
	// Registers a protocol of scheme that will send a String as a response. The usage is the same with registerFileProtocol, except that the callback should be called with either a String or an object that has the data, mimeType, and charset properties.
	RegisterStringProtocol func(Scheme string, Handler ProtocolModuleRegisterStringProtocolHandler, Completion ProtocolModuleRegisterStringProtocolCompletion) `js:"registerStringProtocol"`
	// Registers a protocol of scheme that will send an HTTP request as a response. The usage is the same with registerFileProtocol, except that the callback should be called with a redirectRequest object that has the url, method, referrer, uploadData and session properties. By default the HTTP request will reuse the current session. If you want the request to have a different session you should set session to null. For POST requests the uploadData object must be provided.
	RegisterHttpProtocol func(Scheme string, Handler ProtocolModuleRegisterHttpProtocolHandler, Completion ProtocolModuleRegisterHttpProtocolCompletion) `js:"registerHttpProtocol"`
	// Unregisters the custom protocol of scheme.
	UnregisterProtocol func(Scheme string, Completion ProtocolModuleUnregisterProtocolCompletion) `js:"unregisterProtocol"`
	// The callback will be called with a boolean that indicates whether there is already a handler for scheme.
	IsProtocolHandled func(Scheme string, Callback ProtocolModuleIsProtocolHandledCallback) `js:"isProtocolHandled"`
	// Intercepts scheme protocol and uses handler as the protocol's new handler which sends a file as a response.
	InterceptFileProtocol func(Scheme string, Handler ProtocolModuleInterceptFileProtocolHandler, Completion ProtocolModuleInterceptFileProtocolCompletion) `js:"interceptFileProtocol"`
	// Intercepts scheme protocol and uses handler as the protocol's new handler which sends a String as a response.
	InterceptStringProtocol func(Scheme string, Handler ProtocolModuleInterceptStringProtocolHandler, Completion ProtocolModuleInterceptStringProtocolCompletion) `js:"interceptStringProtocol"`
	// Intercepts scheme protocol and uses handler as the protocol's new handler which sends a Buffer as a response.
	InterceptBufferProtocol func(Scheme string, Handler ProtocolModuleInterceptBufferProtocolHandler, Completion ProtocolModuleInterceptBufferProtocolCompletion) `js:"interceptBufferProtocol"`
	// Intercepts scheme protocol and uses handler as the protocol's new handler which sends a new HTTP request as a response.
	InterceptHttpProtocol func(Scheme string, Handler ProtocolModuleInterceptHttpProtocolHandler, Completion ProtocolModuleInterceptHttpProtocolCompletion) `js:"interceptHttpProtocol"`
	// Remove the interceptor installed for scheme and restore its original handler.
	UninterceptProtocol func(Scheme string, Completion ProtocolModuleUninterceptProtocolCompletion) `js:"uninterceptProtocol"`
}

ProtocolModule version@1.4.15

Register a custom protocol and intercept existing protocol requests.

func GetProtocolModule

func GetProtocolModule() *ProtocolModule

type ProtocolModuleCallbackRedirectRequest

type ProtocolModuleCallbackRedirectRequest struct {
	*js.Object
	URL        string                                   `js:"url"`
	Method     string                                   `js:"method"`
	Session    *ProtocolModuleRedirectRequestSession    `js:"session"`
	UploadData *ProtocolModuleRedirectRequestUploadData `js:"uploadData"`
}

type ProtocolModuleCallbackRedirectRequest2

type ProtocolModuleCallbackRedirectRequest2 struct {
	*js.Object
	URL        string                                    `js:"url"`
	Method     string                                    `js:"method"`
	Session    *ProtocolModuleRedirectRequestSession2    `js:"session"`
	UploadData *ProtocolModuleRedirectRequestUploadData2 `js:"uploadData"`
}

type ProtocolModuleHandlerCallback

type ProtocolModuleHandlerCallback func(Buffer *js.Object)

type ProtocolModuleHandlerCallback2

type ProtocolModuleHandlerCallback2 func(Data string)

type ProtocolModuleHandlerCallback3

type ProtocolModuleHandlerCallback3 func(FilePath string)

type ProtocolModuleHandlerCallback4

type ProtocolModuleHandlerCallback4 func(Buffer *js.Object)

type ProtocolModuleHandlerCallback5

type ProtocolModuleHandlerCallback5 func(FilePath string)

type ProtocolModuleHandlerCallback6

type ProtocolModuleHandlerCallback6 func(RedirectRequest *ProtocolModuleCallbackRedirectRequest)

type ProtocolModuleHandlerCallback7

type ProtocolModuleHandlerCallback7 func(RedirectRequest *ProtocolModuleCallbackRedirectRequest2)

type ProtocolModuleHandlerCallback8

type ProtocolModuleHandlerCallback8 func(Data string)

type ProtocolModuleHandlerRequest

type ProtocolModuleHandlerRequest struct {
	*js.Object
	URL        string     `js:"url"`
	Referrer   string     `js:"referrer"`
	Method     string     `js:"method"`
	UploadData *js.Object `js:"uploadData"`
}

type ProtocolModuleHandlerRequest2

type ProtocolModuleHandlerRequest2 struct {
	*js.Object
	URL        string     `js:"url"`
	Referrer   string     `js:"referrer"`
	Method     string     `js:"method"`
	UploadData *js.Object `js:"uploadData"`
}

type ProtocolModuleHandlerRequest3

type ProtocolModuleHandlerRequest3 struct {
	*js.Object
	URL        string     `js:"url"`
	Referrer   string     `js:"referrer"`
	Method     string     `js:"method"`
	UploadData *js.Object `js:"uploadData"`
}

type ProtocolModuleHandlerRequest4

type ProtocolModuleHandlerRequest4 struct {
	*js.Object
	URL        string     `js:"url"`
	Referrer   string     `js:"referrer"`
	Method     string     `js:"method"`
	UploadData *js.Object `js:"uploadData"`
}

type ProtocolModuleHandlerRequest5

type ProtocolModuleHandlerRequest5 struct {
	*js.Object
	URL        string     `js:"url"`
	Referrer   string     `js:"referrer"`
	Method     string     `js:"method"`
	UploadData *js.Object `js:"uploadData"`
}

type ProtocolModuleHandlerRequest6

type ProtocolModuleHandlerRequest6 struct {
	*js.Object
	URL        string     `js:"url"`
	Referrer   string     `js:"referrer"`
	Method     string     `js:"method"`
	UploadData *js.Object `js:"uploadData"`
}

type ProtocolModuleHandlerRequest7

type ProtocolModuleHandlerRequest7 struct {
	*js.Object
	URL        string     `js:"url"`
	Referrer   string     `js:"referrer"`
	Method     string     `js:"method"`
	UploadData *js.Object `js:"uploadData"`
}

type ProtocolModuleHandlerRequest8

type ProtocolModuleHandlerRequest8 struct {
	*js.Object
	URL        string     `js:"url"`
	Referrer   string     `js:"referrer"`
	Method     string     `js:"method"`
	UploadData *js.Object `js:"uploadData"`
}

type ProtocolModuleInterceptBufferProtocolCompletion

type ProtocolModuleInterceptBufferProtocolCompletion func(Error *js.Object)

type ProtocolModuleInterceptBufferProtocolHandler

type ProtocolModuleInterceptBufferProtocolHandler func(Request *ProtocolModuleHandlerRequest4, Callback ProtocolModuleHandlerCallback4)

type ProtocolModuleInterceptFileProtocolCompletion

type ProtocolModuleInterceptFileProtocolCompletion func(Error *js.Object)

type ProtocolModuleInterceptFileProtocolHandler

type ProtocolModuleInterceptFileProtocolHandler func(Request *ProtocolModuleHandlerRequest3, Callback ProtocolModuleHandlerCallback3)

type ProtocolModuleInterceptHttpProtocolCompletion

type ProtocolModuleInterceptHttpProtocolCompletion func(Error *js.Object)

type ProtocolModuleInterceptHttpProtocolHandler

type ProtocolModuleInterceptHttpProtocolHandler func(Request *ProtocolModuleHandlerRequest7, Callback ProtocolModuleHandlerCallback7)

type ProtocolModuleInterceptStringProtocolCompletion

type ProtocolModuleInterceptStringProtocolCompletion func(Error *js.Object)

type ProtocolModuleInterceptStringProtocolHandler

type ProtocolModuleInterceptStringProtocolHandler func(Request *ProtocolModuleHandlerRequest8, Callback ProtocolModuleHandlerCallback8)

type ProtocolModuleIsProtocolHandledCallback

type ProtocolModuleIsProtocolHandledCallback func(Error *js.Object)

type ProtocolModuleRedirectRequestSession

type ProtocolModuleRedirectRequestSession struct {
	*js.Object
}

type ProtocolModuleRedirectRequestSession2

type ProtocolModuleRedirectRequestSession2 struct {
	*js.Object
}

type ProtocolModuleRedirectRequestUploadData

type ProtocolModuleRedirectRequestUploadData struct {
	*js.Object
	// MIME type of the content.
	ContentType string `js:"contentType"`
	// Content to be sent.
	Data string `js:"data"`
}

type ProtocolModuleRedirectRequestUploadData2

type ProtocolModuleRedirectRequestUploadData2 struct {
	*js.Object
	// MIME type of the content.
	ContentType string `js:"contentType"`
	// Content to be sent.
	Data string `js:"data"`
}

type ProtocolModuleRegisterBufferProtocolCompletion

type ProtocolModuleRegisterBufferProtocolCompletion func(Error *js.Object)

type ProtocolModuleRegisterBufferProtocolHandler

type ProtocolModuleRegisterBufferProtocolHandler func(Request *ProtocolModuleHandlerRequest, Callback ProtocolModuleHandlerCallback)

type ProtocolModuleRegisterFileProtocolCompletion

type ProtocolModuleRegisterFileProtocolCompletion func(Error *js.Object)

type ProtocolModuleRegisterFileProtocolHandler

type ProtocolModuleRegisterFileProtocolHandler func(Request *ProtocolModuleHandlerRequest5, Callback ProtocolModuleHandlerCallback5)

type ProtocolModuleRegisterHttpProtocolCompletion

type ProtocolModuleRegisterHttpProtocolCompletion func(Error *js.Object)

type ProtocolModuleRegisterHttpProtocolHandler

type ProtocolModuleRegisterHttpProtocolHandler func(Request *ProtocolModuleHandlerRequest6, Callback ProtocolModuleHandlerCallback6)

type ProtocolModuleRegisterStandardSchemesOptions

type ProtocolModuleRegisterStandardSchemesOptions struct {
	*js.Object
	// to register the scheme as secure. Default .
	Secure bool `js:"secure"`
}

type ProtocolModuleRegisterStringProtocolCompletion

type ProtocolModuleRegisterStringProtocolCompletion func(Error *js.Object)

type ProtocolModuleRegisterStringProtocolHandler

type ProtocolModuleRegisterStringProtocolHandler func(Request *ProtocolModuleHandlerRequest2, Callback ProtocolModuleHandlerCallback2)

type ProtocolModuleUninterceptProtocolCompletion

type ProtocolModuleUninterceptProtocolCompletion func(Error *js.Object)

type ProtocolModuleUnregisterProtocolCompletion

type ProtocolModuleUnregisterProtocolCompletion func(Error *js.Object)

type Rectangle

type Rectangle struct {
	*js.Object
	// The x coordinate of the origin of the rectangle
	X float64 `js:"x"`
	// The y coordinate of the origin of the rectangle
	Y      float64 `js:"y"`
	Width  float64 `js:"width"`
	Height float64 `js:"height"`
}

Rectangle a Structure

type RemoteModule

type RemoteModule struct {
	*js.Object
	// The process object in the main process. This is the same as remote.getGlobal('process') but is cached.
	Process               string                               `js:"process"`
	Require               func(Module string) (Obj *js.Object) `js:"require"`
	GetCurrentWindow      func() (Obj *BrowserWindow)          `js:"getCurrentWindow"`
	GetCurrentWebContents func() (Obj *WebContents)            `js:"getCurrentWebContents"`
	GetGlobal             func(Name string) (Obj *js.Object)   `js:"getGlobal"`
}

RemoteModule version@1.4.15

Use main process modules from the renderer process.

func GetRemoteModule

func GetRemoteModule() *RemoteModule

type RemoveClientCertificate

type RemoveClientCertificate struct {
	*js.Object
	// .
	Type string `js:"type"`
	// Origin of the server whose associated client certificate must be removed from the cache.
	Origin string `js:"origin"`
}

RemoveClientCertificate a Structure

type RemovePassword

type RemovePassword struct {
	*js.Object
	// .
	Type string `js:"type"`
	// When provided, the authentication info related to the origin will only be removed otherwise the entire cache will be cleared.
	Origin string `js:"origin"`
	// Scheme of the authentication. Can be , , , . Must be provided if removing by .
	Scheme RemovePasswordRemovePasswordScheme `js:"scheme"`
	// Realm of the authentication. Must be provided if removing by .
	Realm string `js:"realm"`
	// Credentials of the authentication. Must be provided if removing by .
	Username string `js:"username"`
	// Credentials of the authentication. Must be provided if removing by .
	Password string `js:"password"`
}

RemovePassword a Structure

type RemovePasswordRemovePasswordScheme

type RemovePasswordRemovePasswordScheme string
const (
	RemovePasswordRemovePasswordSchemeBasic     RemovePasswordRemovePasswordScheme = "basic"
	RemovePasswordRemovePasswordSchemeDigest    RemovePasswordRemovePasswordScheme = "digest"
	RemovePasswordRemovePasswordSchemeNtlm      RemovePasswordRemovePasswordScheme = "ntlm"
	RemovePasswordRemovePasswordSchemeNegotiate RemovePasswordRemovePasswordScheme = "negotiate"
)

consts

type ScreenModule

type ScreenModule struct {
	*events.Emitter
	// The current absolute position of the mouse pointer.
	GetCursorScreenPoint   func() (Obj *ScreenModuleGetCursorScreenPointObj)                     `js:"getCursorScreenPoint"`
	GetPrimaryDisplay      func() (Obj *js.Object)                                               `js:"getPrimaryDisplay"`
	GetAllDisplays         func() (Obj *js.Object)                                               `js:"getAllDisplays"`
	GetDisplayNearestPoint func(Point *ScreenModuleGetDisplayNearestPointPoint) (Obj *js.Object) `js:"getDisplayNearestPoint"`
	GetDisplayMatching     func(Rect *js.Object) (Obj *js.Object)                                `js:"getDisplayMatching"`
}

ScreenModule version@1.4.15

Retrieve information about screen size, displays, cursor position, etc.

func GetScreenModule

func GetScreenModule() *ScreenModule

type ScreenModuleGetCursorScreenPointObj

type ScreenModuleGetCursorScreenPointObj struct {
	*js.Object
	X int64 `js:"x"`
	Y int64 `js:"y"`
}

type ScreenModuleGetDisplayNearestPointPoint

type ScreenModuleGetDisplayNearestPointPoint struct {
	*js.Object
	X int64 `js:"x"`
	Y int64 `js:"y"`
}

type Session

type Session struct {
	*events.Emitter
	// A Cookies object for this session.
	Cookies *Cookies `js:"cookies"`
	// A WebRequest object for this session.
	WebRequest *WebRequest `js:"webRequest"`
	// A Protocol object (an instance of protocol module) for this session.
	Protocol *js.Object `js:"protocol"`
	// Returns the session's current cache size.
	GetCacheSize func(Callback SessionGetCacheSizeCallback) `js:"getCacheSize"`
	// Clears the session’s HTTP cache.
	ClearCache func(Callback SessionClearCacheCallback) `js:"clearCache"`
	// Clears the data of web storages.
	ClearStorageData func(Options *SessionClearStorageDataOptions, Callback SessionClearStorageDataCallback) `js:"clearStorageData"`
	// Writes any unwritten DOMStorage data to disk.
	FlushStorageData func() `js:"flushStorageData"`
	// Sets the proxy settings. When pacScript and proxyRules are provided together, the proxyRules option is ignored and pacScript configuration is applied. The proxyRules has to follow the rules below: For example: The proxyBypassRules is a comma separated list of rules described below:
	SetProxy func(Config *SessionSetProxyConfig, Callback SessionSetProxyCallback) `js:"setProxy"`
	// Resolves the proxy information for url. The callback will be called with callback(proxy) when the request is performed.
	ResolveProxy func(URL *js.Object, Callback SessionResolveProxyCallback) `js:"resolveProxy"`
	// Sets download saving directory. By default, the download directory will be the Downloads under the respective app folder.
	SetDownloadPath func(Path string) `js:"setDownloadPath"`
	// Emulates network with the given configuration for the session.
	EnableNetworkEmulation func(Options *SessionEnableNetworkEmulationOptions) `js:"enableNetworkEmulation"`
	// Disables any network emulation already active for the session. Resets to the original network configuration.
	DisableNetworkEmulation func() `js:"disableNetworkEmulation"`
	// Sets the certificate verify proc for session, the proc will be called with proc(hostname, certificate, callback) whenever a server certificate verification is requested. Calling callback(true) accepts the certificate, calling callback(false) rejects it. Calling setCertificateVerifyProc(null) will revert back to default certificate verify proc.
	SetCertificateVerifyProc func(Proc SessionSetCertificateVerifyProcProc) `js:"setCertificateVerifyProc"`
	// Sets the handler which can be used to respond to permission requests for the session. Calling callback(true) will allow the permission and callback(false) will reject it.
	SetPermissionRequestHandler func(Handler SessionSetPermissionRequestHandlerHandler) `js:"setPermissionRequestHandler"`
	// Clears the host resolver cache.
	ClearHostResolverCache func(Callback SessionClearHostResolverCacheCallback) `js:"clearHostResolverCache"`
	// Dynamically sets whether to always send credentials for HTTP NTLM or Negotiate authentication.
	AllowNTLMCredentialsForDomains func(Domains string) `js:"allowNTLMCredentialsForDomains"`
	// Overrides the userAgent and acceptLanguages for this session. The acceptLanguages must a comma separated ordered list of language codes, for example "en-US,fr,de,ko,zh-CN,ja". This doesn't affect existing WebContents, and each WebContents can use webContents.setUserAgent to override the session-wide user agent.
	SetUserAgent func(UserAgent string, AcceptLanguages string)                                `js:"setUserAgent"`
	GetUserAgent func() (Obj string)                                                           `js:"getUserAgent"`
	GetBlobData  func(Identifier string, Callback SessionGetBlobDataCallback) (Obj *js.Object) `js:"getBlobData"`
	// Allows resuming cancelled or interrupted downloads from previous Session. The API will generate a DownloadItem that can be accessed with the will-download event. The DownloadItem will not have any WebContents associated with it and the initial state will be interrupted. The download will start only when the resume API is called on the DownloadItem.
	CreateInterruptedDownload func(Options *SessionCreateInterruptedDownloadOptions) `js:"createInterruptedDownload"`
	// Clears the session’s HTTP authentication cache.
	ClearAuthCache func(Options *js.Object, Callback SessionClearAuthCacheCallback) `js:"clearAuthCache"`
}

Session version@1.4.15

Get and set properties of a session.

func WrapSession

func WrapSession(o *js.Object) *Session

type SessionCallbackProxy

type SessionCallbackProxy struct {
	*js.Object
}

type SessionClearAuthCacheCallback

type SessionClearAuthCacheCallback func()

type SessionClearCacheCallback

type SessionClearCacheCallback func()

type SessionClearHostResolverCacheCallback

type SessionClearHostResolverCacheCallback func()

type SessionClearStorageDataCallback

type SessionClearStorageDataCallback func()

type SessionClearStorageDataOptions

type SessionClearStorageDataOptions struct {
	*js.Object
	// Should follow ’s representation .
	Origin string `js:"origin"`
	// The types of storages to clear, can contain: , , , , , , ,
	Storages *js.Object `js:"storages"`
	// The types of quotas to clear, can contain: , , .
	Quotas *js.Object `js:"quotas"`
}

type SessionCreateInterruptedDownloadOptions

type SessionCreateInterruptedDownloadOptions struct {
	*js.Object
	// Absolute path of the download.
	Path string `js:"path"`
	// Complete URL chain for the download.
	URLChain *js.Object `js:"urlChain"`
	MimeType string     `js:"mimeType"`
	// Start range for the download.
	Offset int64 `js:"offset"`
	// Total length of the download.
	Length int64 `js:"length"`
	// Last-Modified header value.
	LastModified string `js:"lastModified"`
	// ETag header value.
	ETag string `js:"eTag"`
	// Time when download was started in number of seconds since UNIX epoch.
	StartTime float64 `js:"startTime"`
}

type SessionEnableNetworkEmulationOptions

type SessionEnableNetworkEmulationOptions struct {
	*js.Object
	// Whether to emulate network outage. Defaults to false.
	Offline bool `js:"offline"`
	// RTT in ms. Defaults to 0 which will disable latency throttling.
	Latency float64 `js:"latency"`
	// Download rate in Bps. Defaults to 0 which will disable download throttling.
	DownloadThroughput float64 `js:"downloadThroughput"`
	// Upload rate in Bps. Defaults to 0 which will disable upload throttling.
	UploadThroughput float64 `js:"uploadThroughput"`
}

type SessionGetBlobDataCallback

type SessionGetBlobDataCallback func(
	Result *js.Object)

type SessionGetCacheSizeCallback

type SessionGetCacheSizeCallback func(
	Size int64)

type SessionHandlerCallback

type SessionHandlerCallback func(
	PermissionGranted bool)

type SessionHandlerWebContents

type SessionHandlerWebContents struct {
	*js.Object
}

type SessionModule

type SessionModule struct {
	*js.Object
	// A Session object, the default session object of the app.
	DefaultSession *Session `js:"defaultSession"`
	// If partition starts with persist:, the page will use a persistent session available to all pages in the app with the same partition. if there is no persist: prefix, the page will use an in-memory session. If the partition is empty then default session of the app will be returned. To create a Session with options, you have to ensure the Session with the partition has never been used before. There is no way to change the options of an existing Session object.
	FromPartition func(Partition string, Options *SessionModuleFromPartitionOptions) (Obj *Session) `js:"fromPartition"`
}

SessionModule version@1.4.15

Manage browser sessions, cookies, cache, proxy settings, etc.

func GetSessionModule

func GetSessionModule() *SessionModule

type SessionModuleFromPartitionOptions

type SessionModuleFromPartitionOptions struct {
	*js.Object
	// Whether to enable cache.
	Cache bool `js:"cache"`
}

type SessionProcCallback

type SessionProcCallback func(
	IsTrusted bool)

type SessionResolveProxyCallback

type SessionResolveProxyCallback func(Proxy *SessionCallbackProxy)

type SessionSetCertificateVerifyProcProc

type SessionSetCertificateVerifyProcProc func(Hostname string, Certificate *js.Object, Callback SessionProcCallback)

type SessionSetPermissionRequestHandlerHandler

type SessionSetPermissionRequestHandlerHandler func(
	WebContents *SessionHandlerWebContents,
	Permission string, Callback SessionHandlerCallback)

type SessionSetProxyCallback

type SessionSetProxyCallback func()

type SessionSetProxyConfig

type SessionSetProxyConfig struct {
	*js.Object
	// The URL associated with the PAC file.
	PacScript string `js:"pacScript"`
	// Rules indicating which proxies to use.
	ProxyRules string `js:"proxyRules"`
	// Rules indicating which URLs should bypass the proxy settings.
	ProxyBypassRules string `js:"proxyBypassRules"`
}

type ShellModule

type ShellModule struct {
	*js.Object
	// Show the given file in a file manager. If possible, select the file.
	ShowItemInFolder func(FullPath string) (Obj bool) `js:"showItemInFolder"`
	// Open the given file in the desktop's default manner.
	OpenItem func(FullPath string) (Obj bool) `js:"openItem"`
	// Open the given external protocol URL in the desktop's default manner. (For example, mailto: URLs in the user's default mail agent).
	OpenExternal func(URL string, Options *ShellModuleOpenExternalOptions, Callback ShellModuleOpenExternalCallback) (Obj bool) `js:"openExternal"`
	// Move the given file to trash and returns a boolean status for the operation.
	MoveItemToTrash func(FullPath string) (Obj bool) `js:"moveItemToTrash"`
	// Play the beep sound.
	Beep func() `js:"beep"`
	// Creates or updates a shortcut link at shortcutPath.
	WriteShortcutLink func(ShortcutPath string, Operation ShellModuleWriteShortcutLinkOperation, Options *js.Object) (Obj bool) `js:"writeShortcutLink"`
	// Resolves the shortcut link at shortcutPath. An exception will be thrown when any error happens.
	ReadShortcutLink func(ShortcutPath string) (Obj *js.Object) `js:"readShortcutLink"`
}

ShellModule version@1.4.15

Manage files and URLs using their default applications.

func GetShellModule

func GetShellModule() *ShellModule

type ShellModuleOpenExternalCallback

type ShellModuleOpenExternalCallback func(Error *js.Object)

type ShellModuleOpenExternalOptions

type ShellModuleOpenExternalOptions struct {
	*js.Object
	// to bring the opened application to the foreground. The default is .
	Activate bool `js:"activate"`
}

type ShellModuleWriteShortcutLinkOperation

type ShellModuleWriteShortcutLinkOperation string
const (
	ShellModuleWriteShortcutLinkOperationCreate  ShellModuleWriteShortcutLinkOperation = "create"
	ShellModuleWriteShortcutLinkOperationUpdate  ShellModuleWriteShortcutLinkOperation = "update"
	ShellModuleWriteShortcutLinkOperationReplace ShellModuleWriteShortcutLinkOperation = "replace"
)

consts

type ShortcutDetails

type ShortcutDetails struct {
	*js.Object
	// The target to launch from this shortcut.
	Target string `js:"target"`
	// The working directory. Default is empty.
	Cwd string `js:"cwd"`
	// The arguments to be applied to when launching from this shortcut. Default is empty.
	Args string `js:"args"`
	// The description of the shortcut. Default is empty.
	Description string `js:"description"`
	// The path to the icon, can be a DLL or EXE. and have to be set together. Default is empty, which uses the target's icon.
	Icon string `js:"icon"`
	// The resource ID of icon when is a DLL or EXE. Default is 0.
	IconIndex float64 `js:"iconIndex"`
	// The Application User Model ID. Default is empty.
	AppUserModelId string `js:"appUserModelId"`
}

ShortcutDetails a Structure

type SystemPreferencesModule

type SystemPreferencesModule struct {
	*events.Emitter
	IsDarkMode                             func() (Obj bool) `js:"isDarkMode"`
	IsSwipeTrackingFromScrollEventsEnabled func() (Obj bool) `js:"isSwipeTrackingFromScrollEventsEnabled"`
	// Posts event as native notifications of macOS. The userInfo is an Object that contains the user information dictionary sent along with the notification.
	PostNotification func(Event string, UserInfo *SystemPreferencesModulePostNotificationUserInfo) `js:"postNotification"`
	// Posts event as native notifications of macOS. The userInfo is an Object that contains the user information dictionary sent along with the notification.
	PostLocalNotification func(Event string, UserInfo *SystemPreferencesModulePostLocalNotificationUserInfo) `js:"postLocalNotification"`
	// Subscribes to native notifications of macOS, callback will be called with callback(event, userInfo) when the corresponding event happens. The userInfo is an Object that contains the user information dictionary sent along with the notification. The id of the subscriber is returned, which can be used to unsubscribe the event. Under the hood this API subscribes to NSDistributedNotificationCenter, example values of event are:
	SubscribeNotification func(Event string, Callback SystemPreferencesModuleSubscribeNotificationCallback) `js:"subscribeNotification"`
	// Removes the subscriber with id.
	UnsubscribeNotification func(Id int64) `js:"unsubscribeNotification"`
	// Same as subscribeNotification, but uses NSNotificationCenter for local defaults. This is necessary for events such as NSUserDefaultsDidChangeNotification
	SubscribeLocalNotification func(Event string, Callback SystemPreferencesModuleSubscribeLocalNotificationCallback) `js:"subscribeLocalNotification"`
	// Same as unsubscribeNotification, but removes the subscriber from NSNotificationCenter.
	UnsubscribeLocalNotification func(Id int64) `js:"unsubscribeLocalNotification"`
	// Get the value of key in system preferences. This API uses NSUserDefaults on macOS. Some popular key and types are:
	GetUserDefault func(Key string, Type SystemPreferencesModuleGetUserDefaultType) `js:"getUserDefault"`
	// Set the value of key in system preferences. Note that type should match actual type of value. An exception is thrown if they don't. This API uses NSUserDefaults on macOS. Some popular key and types are:
	SetUserDefault func(Key string, Type string, Value string) `js:"setUserDefault"`
	// This method returns true if DWM composition (Aero Glass) is enabled, and false otherwise. An example of using it to determine if you should create a transparent window or not (transparent windows won't work correctly when DWM composition is disabled):
	IsAeroGlassEnabled    func()                                                        `js:"isAeroGlassEnabled"`
	GetAccentColor        func() (Obj string)                                           `js:"getAccentColor"`
	GetColor              func(Color SystemPreferencesModuleGetColorColor) (Obj string) `js:"getColor"`
	IsInvertedColorScheme func() (Obj bool)                                             `js:"isInvertedColorScheme"`
}

SystemPreferencesModule version@1.4.15

Get system preferences.

func GetSystemPreferencesModule

func GetSystemPreferencesModule() *SystemPreferencesModule

type SystemPreferencesModuleCallbackUserInfo

type SystemPreferencesModuleCallbackUserInfo struct {
	*js.Object
}

type SystemPreferencesModuleCallbackUserInfo2

type SystemPreferencesModuleCallbackUserInfo2 struct {
	*js.Object
}

type SystemPreferencesModuleGetColorColor

type SystemPreferencesModuleGetColorColor string
const (
	SystemPreferencesModuleGetColorColor3dDarkShadow            SystemPreferencesModuleGetColorColor = "3d-dark-shadow"
	SystemPreferencesModuleGetColorColor3dFace                  SystemPreferencesModuleGetColorColor = "3d-face"
	SystemPreferencesModuleGetColorColor3dHighlight             SystemPreferencesModuleGetColorColor = "3d-highlight"
	SystemPreferencesModuleGetColorColor3dLight                 SystemPreferencesModuleGetColorColor = "3d-light"
	SystemPreferencesModuleGetColorColor3dShadow                SystemPreferencesModuleGetColorColor = "3d-shadow"
	SystemPreferencesModuleGetColorColorActiveBorder            SystemPreferencesModuleGetColorColor = "active-border"
	SystemPreferencesModuleGetColorColorActiveCaption           SystemPreferencesModuleGetColorColor = "active-caption"
	SystemPreferencesModuleGetColorColorActiveCaptionGradient   SystemPreferencesModuleGetColorColor = "active-caption-gradient"
	SystemPreferencesModuleGetColorColorAppWorkspace            SystemPreferencesModuleGetColorColor = "app-workspace"
	SystemPreferencesModuleGetColorColorButtonText              SystemPreferencesModuleGetColorColor = "button-text"
	SystemPreferencesModuleGetColorColorCaptionText             SystemPreferencesModuleGetColorColor = "caption-text"
	SystemPreferencesModuleGetColorColorDesktop                 SystemPreferencesModuleGetColorColor = "desktop"
	SystemPreferencesModuleGetColorColorDisabledText            SystemPreferencesModuleGetColorColor = "disabled-text"
	SystemPreferencesModuleGetColorColorHighlight               SystemPreferencesModuleGetColorColor = "highlight"
	SystemPreferencesModuleGetColorColorHighlightText           SystemPreferencesModuleGetColorColor = "highlight-text"
	SystemPreferencesModuleGetColorColorHotlight                SystemPreferencesModuleGetColorColor = "hotlight"
	SystemPreferencesModuleGetColorColorInactiveBorder          SystemPreferencesModuleGetColorColor = "inactive-border"
	SystemPreferencesModuleGetColorColorInactiveCaption         SystemPreferencesModuleGetColorColor = "inactive-caption"
	SystemPreferencesModuleGetColorColorInactiveCaptionGradient SystemPreferencesModuleGetColorColor = "inactive-caption-gradient"
	SystemPreferencesModuleGetColorColorInactiveCaptionText     SystemPreferencesModuleGetColorColor = "inactive-caption-text"
	SystemPreferencesModuleGetColorColorInfoBackground          SystemPreferencesModuleGetColorColor = "info-background"
	SystemPreferencesModuleGetColorColorInfoText                SystemPreferencesModuleGetColorColor = "info-text"
	SystemPreferencesModuleGetColorColorMenu                    SystemPreferencesModuleGetColorColor = "menu"
	SystemPreferencesModuleGetColorColorMenuHighlight           SystemPreferencesModuleGetColorColor = "menu-highlight"
	SystemPreferencesModuleGetColorColorMenubar                 SystemPreferencesModuleGetColorColor = "menubar"
	SystemPreferencesModuleGetColorColorMenuText                SystemPreferencesModuleGetColorColor = "menu-text"
	SystemPreferencesModuleGetColorColorScrollbar               SystemPreferencesModuleGetColorColor = "scrollbar"
	SystemPreferencesModuleGetColorColorWindow                  SystemPreferencesModuleGetColorColor = "window"
	SystemPreferencesModuleGetColorColorWindowFrame             SystemPreferencesModuleGetColorColor = "window-frame"
	SystemPreferencesModuleGetColorColorWindowText              SystemPreferencesModuleGetColorColor = "window-text"
)

consts

type SystemPreferencesModuleGetUserDefaultType

type SystemPreferencesModuleGetUserDefaultType string
const (
	SystemPreferencesModuleGetUserDefaultTypeString     SystemPreferencesModuleGetUserDefaultType = "string"
	SystemPreferencesModuleGetUserDefaultTypeBoolean    SystemPreferencesModuleGetUserDefaultType = "boolean"
	SystemPreferencesModuleGetUserDefaultTypeInteger    SystemPreferencesModuleGetUserDefaultType = "integer"
	SystemPreferencesModuleGetUserDefaultTypeFloat      SystemPreferencesModuleGetUserDefaultType = "float"
	SystemPreferencesModuleGetUserDefaultTypeDouble     SystemPreferencesModuleGetUserDefaultType = "double"
	SystemPreferencesModuleGetUserDefaultTypeURL        SystemPreferencesModuleGetUserDefaultType = "url"
	SystemPreferencesModuleGetUserDefaultTypeArray      SystemPreferencesModuleGetUserDefaultType = "array"
	SystemPreferencesModuleGetUserDefaultTypeDictionary SystemPreferencesModuleGetUserDefaultType = "dictionary"
)

consts

type SystemPreferencesModulePostLocalNotificationUserInfo

type SystemPreferencesModulePostLocalNotificationUserInfo struct {
	*js.Object
}

type SystemPreferencesModulePostNotificationUserInfo

type SystemPreferencesModulePostNotificationUserInfo struct {
	*js.Object
}

type SystemPreferencesModuleSubscribeLocalNotificationCallback

type SystemPreferencesModuleSubscribeLocalNotificationCallback func(Event string, UserInfo *SystemPreferencesModuleCallbackUserInfo)

type SystemPreferencesModuleSubscribeNotificationCallback

type SystemPreferencesModuleSubscribeNotificationCallback func(Event string, UserInfo *SystemPreferencesModuleCallbackUserInfo2)

type Task

type Task struct {
	*js.Object
	// Path of the program to execute, usually you should specify which opens the current program.
	Program string `js:"program"`
	// The command line arguments when is executed.
	Arguments string `js:"arguments"`
	// The string to be displayed in a JumpList.
	Title string `js:"title"`
	// Description of this task.
	Description string `js:"description"`
	// The absolute path to an icon to be displayed in a JumpList, which can be an arbitrary resource file that contains an icon. You can usually specify to show the icon of the program.
	IconPath string `js:"iconPath"`
	// The icon index in the icon file. If an icon file consists of two or more icons, set this value to identify the icon. If an icon file consists of one icon, this value is 0.
	IconIndex float64 `js:"iconIndex"`
}

Task a Structure

type ThumbarButton

type ThumbarButton struct {
	*js.Object
	// The icon showing in thumbnail toolbar.
	Icon  *NativeImage                    `js:"icon"`
	Click ThumbarButtonThumbarButtonClick `js:"click"`
	// The text of the button's tooltip.
	Tooltip string `js:"tooltip"`
	// Control specific states and behaviors of the button. By default, it is .
	Flags *js.Object `js:"flags"`
}

ThumbarButton a Structure

type ThumbarButtonThumbarButtonClick

type ThumbarButtonThumbarButtonClick func()

type Tray

type Tray struct {
	*events.Emitter
	// Destroys the tray icon immediately.
	Destroy func() `js:"destroy"`
	// Sets the image associated with this tray icon.
	SetImage func(Image *NativeImage) `js:"setImage"`
	// Sets the image associated with this tray icon when pressed on macOS.
	SetPressedImage func(Image *NativeImage) `js:"setPressedImage"`
	// Sets the hover text for this tray icon.
	SetToolTip func(ToolTip string) `js:"setToolTip"`
	// Sets the title displayed aside of the tray icon in the status bar.
	SetTitle func(Title string) `js:"setTitle"`
	// Sets when the tray's icon background becomes highlighted (in blue). Note: You can use highlightMode with a BrowserWindow by toggling between 'never' and 'always' modes when the window visibility changes.
	SetHighlightMode func(Mode TraySetHighlightModeMode) `js:"setHighlightMode"`
	// Displays a tray balloon.
	DisplayBalloon func(Options *TrayDisplayBalloonOptions) `js:"displayBalloon"`
	// Pops up the context menu of the tray icon. When menu is passed, the menu will be shown instead of the tray icon's context menu. The position is only available on Windows, and it is (0, 0) by default.
	PopUpContextMenu func(Menu *Menu, Position *TrayPopUpContextMenuPosition) `js:"popUpContextMenu"`
	// Sets the context menu for this icon.
	SetContextMenu func(Menu *Menu) `js:"setContextMenu"`
	// The bounds of this tray icon as Object.
	GetBounds   func() (Obj *js.Object) `js:"getBounds"`
	IsDestroyed func() (Obj bool)       `js:"isDestroyed"`
}

Tray version@1.4.15

Add icons and context menus to the system's notification area.

func NewTray

func NewTray(Image *NativeImage) *Tray

func WrapTray

func WrapTray(o *js.Object) *Tray

type TrayDisplayBalloonOptions

type TrayDisplayBalloonOptions struct {
	*js.Object
	// (optional)
	Icon *NativeImage `js:"icon"`
	// (optional)
	Title string `js:"title"`
	// (optional)
	Content string `js:"content"`
}

type TrayPopUpContextMenuPosition

type TrayPopUpContextMenuPosition struct {
	*js.Object
	X int64 `js:"x"`
	Y int64 `js:"y"`
}

type TraySetHighlightModeMode

type TraySetHighlightModeMode string
const (
	TraySetHighlightModeModeSelection TraySetHighlightModeMode = "selection"
	TraySetHighlightModeModeAlways    TraySetHighlightModeMode = "always"
	TraySetHighlightModeModeNever     TraySetHighlightModeMode = "never"
)

consts

type UploadBlob

type UploadBlob struct {
	*js.Object
	// .
	Type string `js:"type"`
	// UUID of blob data to upload.
	BlobUUID string `js:"blobUUID"`
}

UploadBlob a Structure

type UploadData

type UploadData struct {
	*js.Object
	// Content being sent.
	Bytes *js.Object `js:"bytes"`
	// Path of file being uploaded.
	File string `js:"file"`
	// UUID of blob data. Use method to retrieve the data.
	BlobUUID string `js:"blobUUID"`
}

UploadData a Structure

type UploadFile

type UploadFile struct {
	*js.Object
	// .
	Type string `js:"type"`
	// Path of file to be uploaded.
	FilePath string `js:"filePath"`
	// Defaults to .
	Offset int64 `js:"offset"`
	// Number of bytes to read from . Defaults to .
	Length int64 `js:"length"`
	// Last Modification time in number of seconds sine the UNIX epoch.
	ModificationTime float64 `js:"modificationTime"`
}

UploadFile a Structure

type UploadFileSystem

type UploadFileSystem struct {
	*js.Object
	// .
	Type string `js:"type"`
	// FileSystem url to read data for upload.
	FilsSystemURL string `js:"filsSystemURL"`
	// Defaults to .
	Offset int64 `js:"offset"`
	// Number of bytes to read from . Defaults to .
	Length int64 `js:"length"`
	// Last Modification time in number of seconds sine the UNIX epoch.
	ModificationTime float64 `js:"modificationTime"`
}

UploadFileSystem a Structure

type UploadRawData

type UploadRawData struct {
	*js.Object
	// .
	Type string `js:"type"`
	// Data to be uploaded.
	Bytes *js.Object `js:"bytes"`
}

UploadRawData a Structure

type WebContents

type WebContents struct {
	*events.Emitter
	// A Integer representing the unique ID of this WebContents.
	Id int64 `js:"id"`
	// A Session object (session) used by this webContents.
	Session *Session `js:"session"`
	// A WebContents instance that might own this WebContents.
	HostWebContents *WebContents `js:"hostWebContents"`
	// A WebContents of DevTools for this WebContents. Note: Users should never store this object because it may become null when the DevTools has been closed.
	DevToolsWebContents *WebContents `js:"devToolsWebContents"`
	// A Debugger instance for this webContents.
	Debugger *js.Object `js:"debugger"`
	// Loads the url in the window. The url must contain the protocol prefix, e.g. the http:// or file://. If the load should bypass http cache then use the pragma header to achieve it.
	LoadURL func(URL string, Options *WebContentsLoadURLOptions) `js:"loadURL"`
	// Initiates a download of the resource at url without navigating. The will-download event of session will be triggered.
	DownloadURL          func(URL string)    `js:"downloadURL"`
	GetURL               func() (Obj string) `js:"getURL"`
	GetTitle             func() (Obj string) `js:"getTitle"`
	IsDestroyed          func() (Obj bool)   `js:"isDestroyed"`
	IsFocused            func() (Obj bool)   `js:"isFocused"`
	IsLoading            func() (Obj bool)   `js:"isLoading"`
	IsLoadingMainFrame   func() (Obj bool)   `js:"isLoadingMainFrame"`
	IsWaitingForResponse func() (Obj bool)   `js:"isWaitingForResponse"`
	// Stops any pending navigation.
	Stop func() `js:"stop"`
	// Reloads the current web page.
	Reload func() `js:"reload"`
	// Reloads current page and ignores cache.
	ReloadIgnoringCache func()                        `js:"reloadIgnoringCache"`
	CanGoBack           func() (Obj bool)             `js:"canGoBack"`
	CanGoForward        func() (Obj bool)             `js:"canGoForward"`
	CanGoToOffset       func(Offset int64) (Obj bool) `js:"canGoToOffset"`
	// Clears the navigation history.
	ClearHistory func() `js:"clearHistory"`
	// Makes the browser go back a web page.
	GoBack func() `js:"goBack"`
	// Makes the browser go forward a web page.
	GoForward func() `js:"goForward"`
	// Navigates browser to the specified absolute web page index.
	GoToIndex func(Index int64) `js:"goToIndex"`
	// Navigates to the specified offset from the "current entry".
	GoToOffset func(Offset int64) `js:"goToOffset"`
	IsCrashed  func() (Obj bool)  `js:"isCrashed"`
	// Overrides the user agent for this web page.
	SetUserAgent func(UserAgent string) `js:"setUserAgent"`
	GetUserAgent func() (Obj string)    `js:"getUserAgent"`
	// Injects CSS into the current web page.
	InsertCSS func(Css string) `js:"insertCSS"`
	// Evaluates code in page. In the browser window some HTML APIs like requestFullScreen can only be invoked by a gesture from the user. Setting userGesture to true will remove this limitation. If the result of the executed code is a promise the callback result will be the resolved value of the promise.  We recommend that you use the returned Promise to handle code that results in a Promise.
	ExecuteJavaScript func(Code string, UserGesture bool, Callback WebContentsExecuteJavaScriptCallback) (Obj *js.Object) `js:"executeJavaScript"`
	// Mute the audio on the current web page.
	SetAudioMuted func(Muted bool)  `js:"setAudioMuted"`
	IsAudioMuted  func() (Obj bool) `js:"isAudioMuted"`
	// Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.
	SetZoomFactor func(Factor float64) `js:"setZoomFactor"`
	// Sends a request to get current zoom factor, the callback will be called with callback(zoomFactor).
	GetZoomFactor func(Callback WebContentsGetZoomFactorCallback) `js:"getZoomFactor"`
	// Changes the zoom level to the specified level. The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively.
	SetZoomLevel func(Level float64) `js:"setZoomLevel"`
	// Sends a request to get current zoom level, the callback will be called with callback(zoomLevel).
	GetZoomLevel func(Callback WebContentsGetZoomLevelCallback) `js:"getZoomLevel"`
	// Deprecated: Call setVisualZoomLevelLimits instead to set the visual zoom level limits. This method will be removed in Electron 2.0.
	SetZoomLevelLimits func(MinimumLevel float64, MaximumLevel float64) `js:"setZoomLevelLimits"`
	// Sets the maximum and minimum pinch-to-zoom level.
	SetVisualZoomLevelLimits func(MinimumLevel float64, MaximumLevel float64) `js:"setVisualZoomLevelLimits"`
	// Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
	SetLayoutZoomLevelLimits func(MinimumLevel float64, MaximumLevel float64) `js:"setLayoutZoomLevelLimits"`
	// Executes the editing command undo in web page.
	Undo func() `js:"undo"`
	// Executes the editing command redo in web page.
	Redo func() `js:"redo"`
	// Executes the editing command cut in web page.
	Cut func() `js:"cut"`
	// Executes the editing command copy in web page.
	Copy func() `js:"copy"`
	// Copy the image at the given position to the clipboard.
	CopyImageAt func(X int64, Y int64) `js:"copyImageAt"`
	// Executes the editing command paste in web page.
	Paste func() `js:"paste"`
	// Executes the editing command pasteAndMatchStyle in web page.
	PasteAndMatchStyle func() `js:"pasteAndMatchStyle"`
	// Executes the editing command delete in web page.
	Delete func() `js:"delete"`
	// Executes the editing command selectAll in web page.
	SelectAll func() `js:"selectAll"`
	// Executes the editing command unselect in web page.
	Unselect func() `js:"unselect"`
	// Executes the editing command replace in web page.
	Replace func(Text string) `js:"replace"`
	// Executes the editing command replaceMisspelling in web page.
	ReplaceMisspelling func(Text string) `js:"replaceMisspelling"`
	// Inserts text to the focused element.
	InsertText func(Text string) `js:"insertText"`
	// Starts a request to find all matches for the text in the web page and returns an Integer representing the request id used for the request. The result of the request can be obtained by subscribing to found-in-page event.
	FindInPage func(Text string, Options *WebContentsFindInPageOptions) `js:"findInPage"`
	// Stops any findInPage request for the webContents with the provided action.
	StopFindInPage func(Action WebContentsStopFindInPageAction) `js:"stopFindInPage"`
	// Captures a snapshot of the page within rect. Upon completion callback will be called with callback(image). The image is an instance of NativeImage that stores data of the snapshot. Omitting rect will capture the whole visible page.
	CapturePage func(Rect *js.Object, Callback WebContentsCapturePageCallback) `js:"capturePage"`
	// Checks if any ServiceWorker is registered and returns a boolean as response to callback.
	HasServiceWorker func(Callback WebContentsHasServiceWorkerCallback) `js:"hasServiceWorker"`
	// Unregisters any ServiceWorker if present and returns a boolean as response to callback when the JS promise is fulfilled or false when the JS promise is rejected.
	UnregisterServiceWorker func(Callback WebContentsUnregisterServiceWorkerCallback) `js:"unregisterServiceWorker"`
	// Prints window's web page. When silent is set to true, Electron will pick up system's default printer and default settings for printing. Calling window.print() in web page is equivalent to calling webContents.print({silent: false, printBackground: false}). Use page-break-before: always; CSS style to force to print to a new page.
	Print func(Options *WebContentsPrintOptions) `js:"print"`
	// Prints window's web page as PDF with Chromium's preview printing custom settings. The callback will be called with callback(error, data) on completion. The data is a Buffer that contains the generated PDF data. The landscape will be ignored if @page CSS at-rule is used in the web page. By default, an empty options will be regarded as: Use page-break-before: always; CSS style to force to print to a new page. An example of webContents.printToPDF:
	PrintToPDF func(Options *WebContentsPrintToPDFOptions, Callback WebContentsPrintToPDFCallback) `js:"printToPDF"`
	// Adds the specified path to DevTools workspace. Must be used after DevTools creation:
	AddWorkSpace func(Path string) `js:"addWorkSpace"`
	// Removes the specified path from DevTools workspace.
	RemoveWorkSpace func(Path string) `js:"removeWorkSpace"`
	// Opens the devtools.
	OpenDevTools func(Options *WebContentsOpenDevToolsOptions) `js:"openDevTools"`
	// Closes the devtools.
	CloseDevTools     func()            `js:"closeDevTools"`
	IsDevToolsOpened  func() (Obj bool) `js:"isDevToolsOpened"`
	IsDevToolsFocused func() (Obj bool) `js:"isDevToolsFocused"`
	// Toggles the developer tools.
	ToggleDevTools func() `js:"toggleDevTools"`
	// Starts inspecting element at position (x, y).
	InspectElement func(X int64, Y int64) `js:"inspectElement"`
	// Opens the developer tools for the service worker context.
	InspectServiceWorker func() `js:"inspectServiceWorker"`
	// Send an asynchronous message to renderer process via channel, you can also send arbitrary arguments. Arguments will be serialized in JSON internally and hence no functions or prototype chain will be included. The renderer process can handle the message by listening to channel with the ipcRenderer module. An example of sending messages from the main process to the renderer process:
	Send func(Channel string, Args *js.Object) `js:"send"`
	// Enable device emulation with the given parameters.
	EnableDeviceEmulation func(Parameters *WebContentsEnableDeviceEmulationParameters) `js:"enableDeviceEmulation"`
	// Disable device emulation enabled by webContents.enableDeviceEmulation.
	DisableDeviceEmulation func() `js:"disableDeviceEmulation"`
	// Sends an input event to the page. For keyboard events, the event object also have following properties: For mouse events, the event object also have following properties: For the mouseWheel event, the event object also have following properties:
	SendInputEvent func(Event *WebContentsSendInputEventEvent) `js:"sendInputEvent"`
	// Begin subscribing for presentation events and captured frames, the callback will be called with callback(frameBuffer, dirtyRect) when there is a presentation event. The frameBuffer is a Buffer that contains raw pixel data. On most machines, the pixel data is effectively stored in 32bit BGRA format, but the actual representation depends on the endianness of the processor (most modern processors are little-endian, on machines with big-endian processors the data is in 32bit ARGB format). The dirtyRect is an object with x, y, width, height properties that describes which part of the page was repainted. If onlyDirty is set to true, frameBuffer will only contain the repainted area. onlyDirty defaults to false.
	BeginFrameSubscription func(OnlyDirty bool, Callback WebContentsBeginFrameSubscriptionCallback) `js:"beginFrameSubscription"`
	// End subscribing for frame presentation events.
	EndFrameSubscription func() `js:"endFrameSubscription"`
	// Sets the item as dragging item for current drag-drop operation, file is the absolute path of the file to be dragged, and icon is the image showing under the cursor when dragging.
	StartDrag func(Item *WebContentsStartDragItem) `js:"startDrag"`
	// Returns true if the process of saving page has been initiated successfully.
	SavePage func(FullPath string, SaveType WebContentsSavePageSaveType, Callback WebContentsSavePageCallback) `js:"savePage"`
	// Shows pop-up dictionary that searches the selected word on the page.
	ShowDefinitionForSelection func() `js:"showDefinitionForSelection"`
	// Set the size of the page. This is only supported for  guest contents.
	SetSize     func(Options *WebContentsSetSizeOptions) `js:"setSize"`
	IsOffscreen func() (Obj bool)                        `js:"isOffscreen"`
	// If offscreen rendering is enabled and not painting, start painting.
	StartPainting func() `js:"startPainting"`
	// If offscreen rendering is enabled and painting, stop painting.
	StopPainting func()            `js:"stopPainting"`
	IsPainting   func() (Obj bool) `js:"isPainting"`
	// If offscreen rendering is enabled sets the frame rate to the specified number. Only values between 1 and 60 are accepted.
	SetFrameRate func(Fps int64)    `js:"setFrameRate"`
	GetFrameRate func() (Obj int64) `js:"getFrameRate"`
	// If offscreen rendering is enabled invalidates the frame and generates a new one through the 'paint' event.
	Invalidate func() `js:"invalidate"`
}

WebContents version@1.4.15

Render and control the contents of a BrowserWindow instance.

func WrapWebContents

func WrapWebContents(o *js.Object) *WebContents

type WebContentsBeginFrameSubscriptionCallback

type WebContentsBeginFrameSubscriptionCallback func(FrameBuffer *js.Object, DirtyRect *js.Object)

type WebContentsCapturePageCallback

type WebContentsCapturePageCallback func(Image *NativeImage)

type WebContentsEnableDeviceEmulationParameters

type WebContentsEnableDeviceEmulationParameters struct {
	*js.Object
	// Specify the screen type to emulate (default: )
	ScreenPosition WebContentsParametersScreenPosition `js:"screenPosition"`
	// Set the emulated screen size (screenPosition == mobile)
	ScreenSize *WebContentsParametersScreenSize `js:"screenSize"`
	// Position the view on the screen (screenPosition == mobile) (default: )
	ViewPosition *WebContentsParametersViewPosition `js:"viewPosition"`
	// Set the device scale factor (if zero defaults to original device scale factor) (default: )
	DeviceScaleFactor int64 `js:"deviceScaleFactor"`
	// Set the emulated view size (empty means no override)
	ViewSize *WebContentsParametersViewSize `js:"viewSize"`
	// Whether emulated view should be scaled down if necessary to fit into available space (default: )
	FitToView bool `js:"fitToView"`
	// Offset of the emulated view inside available space (not in fit to view mode) (default: )
	Offset *WebContentsParametersOffset `js:"offset"`
	// Scale of emulated view inside available space (not in fit to view mode) (default: )
	Scale float64 `js:"scale"`
}

type WebContentsEventType

type WebContentsEventType string
const (
	WebContentsEventTypeMouseDown   WebContentsEventType = "mouseDown"
	WebContentsEventTypeMouseUp     WebContentsEventType = "mouseUp"
	WebContentsEventTypeMouseEnter  WebContentsEventType = "mouseEnter"
	WebContentsEventTypeMouseLeave  WebContentsEventType = "mouseLeave"
	WebContentsEventTypeContextMenu WebContentsEventType = "contextMenu"
	WebContentsEventTypeMouseWheel  WebContentsEventType = "mouseWheel"
	WebContentsEventTypeMouseMove   WebContentsEventType = "mouseMove"
	WebContentsEventTypeKeyDown     WebContentsEventType = "keyDown"
	WebContentsEventTypeKeyUp       WebContentsEventType = "keyUp"
	WebContentsEventTypeChar        WebContentsEventType = "char"
)

consts

type WebContentsExecuteJavaScriptCallback

type WebContentsExecuteJavaScriptCallback func(Result *js.Object)

type WebContentsFindInPageOptions

type WebContentsFindInPageOptions struct {
	*js.Object
	// (optional) Whether to search forward or backward, defaults to .
	Forward bool `js:"forward"`
	// (optional) Whether the operation is first request or a follow up, defaults to .
	FindNext bool `js:"findNext"`
	// (optional) Whether search should be case-sensitive, defaults to .
	MatchCase bool `js:"matchCase"`
	// (optional) Whether to look only at the start of words. defaults to .
	WordStart bool `js:"wordStart"`
	// (optional) When combined with , accepts a match in the middle of a word if the match begins with an uppercase letter followed by a lowercase or non-letter. Accepts several other intra-word matches, defaults to .
	MedialCapitalAsWordStart bool `js:"medialCapitalAsWordStart"`
}

type WebContentsGetZoomFactorCallback

type WebContentsGetZoomFactorCallback func(ZoomFactor float64)

type WebContentsGetZoomLevelCallback

type WebContentsGetZoomLevelCallback func(ZoomLevel float64)

type WebContentsHasServiceWorkerCallback

type WebContentsHasServiceWorkerCallback func(HasWorker bool)

type WebContentsLoadURLOptions

type WebContentsLoadURLOptions struct {
	*js.Object
	// A HTTP Referrer url.
	HttpReferrer string `js:"httpReferrer"`
	// A user agent originating the request.
	UserAgent string `js:"userAgent"`
	// Extra headers separated by "\n"
	ExtraHeaders string `js:"extraHeaders"`
	// [] (optional)
	PostData *js.Object `js:"postData"`
}

type WebContentsModule

type WebContentsModule struct {
	*js.Object
	GetAllWebContents     func() (Obj *js.Object)           `js:"getAllWebContents"`
	GetFocusedWebContents func() (Obj *WebContents)         `js:"getFocusedWebContents"`
	FromId                func(Id int64) (Obj *WebContents) `js:"fromId"`
}

WebContentsModule version@1.4.15

Render and control web pages.

func GetWebContentsModule

func GetWebContentsModule() *WebContentsModule

type WebContentsOpenDevToolsOptions

type WebContentsOpenDevToolsOptions struct {
	*js.Object
	// Opens the devtools with specified dock state, can be , , , . Defaults to last used dock state. In mode it's possible to dock back. In mode it's not.
	Mode WebContentsOptionsMode `js:"mode"`
}

type WebContentsOptionsMode

type WebContentsOptionsMode string
const (
	WebContentsOptionsModeRight    WebContentsOptionsMode = "right"
	WebContentsOptionsModeBottom   WebContentsOptionsMode = "bottom"
	WebContentsOptionsModeUndocked WebContentsOptionsMode = "undocked"
	WebContentsOptionsModeDetach   WebContentsOptionsMode = "detach"
)

consts

type WebContentsOptionsNormal

type WebContentsOptionsNormal struct {
	*js.Object
	Width  int64 `js:"width"`
	Height int64 `js:"height"`
}

type WebContentsParametersOffset

type WebContentsParametersOffset struct {
	*js.Object
	// Set the x axis offset from top left corner
	X float64 `js:"x"`
	// Set the y axis offset from top left corner
	Y float64 `js:"y"`
}

type WebContentsParametersScreenPosition

type WebContentsParametersScreenPosition string
const (
	WebContentsParametersScreenPositionDesktop WebContentsParametersScreenPosition = "desktop"
	WebContentsParametersScreenPositionMobile  WebContentsParametersScreenPosition = "mobile"
)

consts

type WebContentsParametersScreenSize

type WebContentsParametersScreenSize struct {
	*js.Object
	// Set the emulated screen width
	Width int64 `js:"width"`
	// Set the emulated screen height
	Height int64 `js:"height"`
}

type WebContentsParametersViewPosition

type WebContentsParametersViewPosition struct {
	*js.Object
	// Set the x axis offset from top left corner
	X int64 `js:"x"`
	// Set the y axis offset from top left corner
	Y int64 `js:"y"`
}

type WebContentsParametersViewSize

type WebContentsParametersViewSize struct {
	*js.Object
	// Set the emulated view width
	Width int64 `js:"width"`
	// Set the emulated view height
	Height int64 `js:"height"`
}

type WebContentsPrintOptions

type WebContentsPrintOptions struct {
	*js.Object
	// Don't ask user for print settings. Default is .
	Silent bool `js:"silent"`
	// Also prints the background color and image of the web page. Default is .
	PrintBackground bool `js:"printBackground"`
}

type WebContentsPrintToPDFCallback

type WebContentsPrintToPDFCallback func(Error *js.Object, Data *js.Object)

type WebContentsPrintToPDFOptions

type WebContentsPrintToPDFOptions struct {
	*js.Object
	// (optional) Specifies the type of margins to use. Uses 0 for default margin, 1 for no margin, and 2 for minimum margin.
	MarginsType int64 `js:"marginsType"`
	// (optional) Specify page size of the generated PDF. Can be , , , , , or an Object containing and in microns.
	PageSize string `js:"pageSize"`
	// (optional) Whether to print CSS backgrounds.
	PrintBackground bool `js:"printBackground"`
	// (optional) Whether to print selection only.
	PrintSelectionOnly bool `js:"printSelectionOnly"`
	// (optional) for landscape, for portrait.
	Landscape bool `js:"landscape"`
}

type WebContentsSavePageCallback

type WebContentsSavePageCallback func(Error *js.Object)

type WebContentsSavePageSaveType

type WebContentsSavePageSaveType string
const (
	WebContentsSavePageSaveTypeHTMLOnly     WebContentsSavePageSaveType = "HTMLOnly"
	WebContentsSavePageSaveTypeHTMLComplete WebContentsSavePageSaveType = "HTMLComplete"
	WebContentsSavePageSaveTypeMHTML        WebContentsSavePageSaveType = "MHTML"
)

consts

type WebContentsSendInputEventEvent

type WebContentsSendInputEventEvent struct {
	*js.Object
	// () The type of the event, can be , , , , , , , , , .
	Type WebContentsEventType `js:"type"`
	// An array of modifiers of the event, can include , , , , , , , , , , , , .
	Modifiers *js.Object `js:"modifiers"`
}

type WebContentsSetSizeOptions

type WebContentsSetSizeOptions struct {
	*js.Object
	// Normal size of the page. This can be used in combination with the attribute to manually resize the webview guest contents.
	Normal *WebContentsOptionsNormal `js:"normal"`
}

type WebContentsStartDragItem

type WebContentsStartDragItem struct {
	*js.Object
	File string       `js:"file"`
	Icon *NativeImage `js:"icon"`
}

type WebContentsStopFindInPageAction

type WebContentsStopFindInPageAction string
const (
	WebContentsStopFindInPageActionClearSelection    WebContentsStopFindInPageAction = "clearSelection"
	WebContentsStopFindInPageActionKeepSelection     WebContentsStopFindInPageAction = "keepSelection"
	WebContentsStopFindInPageActionActivateSelection WebContentsStopFindInPageAction = "activateSelection"
)

consts

type WebContentsUnregisterServiceWorkerCallback

type WebContentsUnregisterServiceWorkerCallback func(Success bool)

type WebFrameModule

type WebFrameModule struct {
	*js.Object
	// Changes the zoom factor to the specified factor. Zoom factor is zoom percent divided by 100, so 300% = 3.0.
	SetZoomFactor func(Factor float64) `js:"setZoomFactor"`
	GetZoomFactor func() (Obj float64) `js:"getZoomFactor"`
	// Changes the zoom level to the specified level. The original size is 0 and each increment above or below represents zooming 20% larger or smaller to default limits of 300% and 50% of original size, respectively.
	SetZoomLevel func(Level float64)  `js:"setZoomLevel"`
	GetZoomLevel func() (Obj float64) `js:"getZoomLevel"`
	// Deprecated: Call setVisualZoomLevelLimits instead to set the visual zoom level limits. This method will be removed in Electron 2.0.
	SetZoomLevelLimits func(MinimumLevel float64, MaximumLevel float64) `js:"setZoomLevelLimits"`
	// Sets the maximum and minimum pinch-to-zoom level.
	SetVisualZoomLevelLimits func(MinimumLevel float64, MaximumLevel float64) `js:"setVisualZoomLevelLimits"`
	// Sets the maximum and minimum layout-based (i.e. non-visual) zoom level.
	SetLayoutZoomLevelLimits func(MinimumLevel float64, MaximumLevel float64) `js:"setLayoutZoomLevelLimits"`
	// Sets a provider for spell checking in input fields and text areas. The provider must be an object that has a spellCheck method that returns whether the word passed is correctly spelled. An example of using node-spellchecker as provider:
	SetSpellCheckProvider func(Language string, AutoCorrectWord bool, Provider *WebFrameModuleSetSpellCheckProviderProvider) `js:"setSpellCheckProvider"`
	// Registers the scheme as secure scheme. Secure schemes do not trigger mixed content warnings. For example, https and data are secure schemes because they cannot be corrupted by active network attackers.
	RegisterURLSchemeAsSecure func(Scheme string) `js:"registerURLSchemeAsSecure"`
	// Resources will be loaded from this scheme regardless of the current page's Content Security Policy.
	RegisterURLSchemeAsBypassingCSP func(Scheme string) `js:"registerURLSchemeAsBypassingCSP"`
	// Registers the scheme as secure, bypasses content security policy for resources, allows registering ServiceWorker and supports fetch API. Specify an option with the value of false to omit it from the registration. An example of registering a privileged scheme, without bypassing Content Security Policy:
	RegisterURLSchemeAsPrivileged func(Scheme string, Options *WebFrameModuleRegisterURLSchemeAsPrivilegedOptions) `js:"registerURLSchemeAsPrivileged"`
	// Inserts text to the focused element.
	InsertText func(Text string) `js:"insertText"`
	// Evaluates code in page. In the browser window some HTML APIs like requestFullScreen can only be invoked by a gesture from the user. Setting userGesture to true will remove this limitation.
	ExecuteJavaScript func(Code string, UserGesture bool, Callback WebFrameModuleExecuteJavaScriptCallback) `js:"executeJavaScript"`
	// Returns an object describing usage information of Blink's internal memory caches. This will generate:
	GetResourceUsage func() (Obj *WebFrameModuleGetResourceUsageObj) `js:"getResourceUsage"`
	// Attempts to free memory that is no longer being used (like images from a previous navigation). Note that blindly calling this method probably makes Electron slower since it will have to refill these emptied caches, you should only call it if an event in your app has occurred that makes you think your page is actually using less memory (i.e. you have navigated from a super heavy page to a mostly empty one, and intend to stay there).
	ClearCache func() `js:"clearCache"`
}

WebFrameModule version@1.4.15

Customize the rendering of the current web page.

func GetWebFrameModule

func GetWebFrameModule() *WebFrameModule

type WebFrameModuleExecuteJavaScriptCallback

type WebFrameModuleExecuteJavaScriptCallback func(Result *js.Object)

type WebFrameModuleGetResourceUsageObj

type WebFrameModuleGetResourceUsageObj struct {
	*js.Object
	Images         *js.Object `js:"images"`
	CssStyleSheets *js.Object `js:"cssStyleSheets"`
	XslStyleSheets *js.Object `js:"xslStyleSheets"`
	Fonts          *js.Object `js:"fonts"`
	Other          *js.Object `js:"other"`
}

type WebFrameModuleProviderSpellCheck

type WebFrameModuleProviderSpellCheck func(Text string)

type WebFrameModuleRegisterURLSchemeAsPrivilegedOptions

type WebFrameModuleRegisterURLSchemeAsPrivilegedOptions struct {
	*js.Object
	// (optional) Default true.
	Secure bool `js:"secure"`
	// (optional) Default true.
	BypassCSP bool `js:"bypassCSP"`
	// (optional) Default true.
	AllowServiceWorkers bool `js:"allowServiceWorkers"`
	// (optional) Default true.
	SupportFetchAPI bool `js:"supportFetchAPI"`
	// (optional) Default true.
	CorsEnabled bool `js:"corsEnabled"`
}

type WebFrameModuleSetSpellCheckProviderProvider

type WebFrameModuleSetSpellCheckProviderProvider struct {
	*js.Object
	// Returns
	SpellCheck WebFrameModuleProviderSpellCheck `js:"spellCheck"`
}

type WebRequest

type WebRequest struct {
	*js.Object
	// The listener will be called with listener(details, callback) when a request is about to occur. The uploadData is an array of UploadData objects. The callback has to be called with an response object.
	OnBeforeRequest func(Filter *WebRequestOnBeforeRequestFilter, Listener WebRequestOnBeforeRequestListener) `js:"onBeforeRequest"`
	// The listener will be called with listener(details, callback) before sending an HTTP request, once the request headers are available. This may occur after a TCP connection is made to the server, but before any http data is sent. The callback has to be called with an response object.
	OnBeforeSendHeaders func(Filter *WebRequestOnBeforeSendHeadersFilter, Listener WebRequestOnBeforeSendHeadersListener) `js:"onBeforeSendHeaders"`
	// The listener will be called with listener(details) just before a request is going to be sent to the server, modifications of previous onBeforeSendHeaders response are visible by the time this listener is fired.
	OnSendHeaders func(Filter *WebRequestOnSendHeadersFilter, Listener WebRequestOnSendHeadersListener) `js:"onSendHeaders"`
	// The listener will be called with listener(details, callback) when HTTP response headers of a request have been received. The callback has to be called with an response object.
	OnHeadersReceived func(Filter *WebRequestOnHeadersReceivedFilter, Listener WebRequestOnHeadersReceivedListener) `js:"onHeadersReceived"`
	// The listener will be called with listener(details) when first byte of the response body is received. For HTTP requests, this means that the status line and response headers are available.
	OnResponseStarted func(Filter *WebRequestOnResponseStartedFilter, Listener WebRequestOnResponseStartedListener) `js:"onResponseStarted"`
	// The listener will be called with listener(details) when a server initiated redirect is about to occur.
	OnBeforeRedirect func(Filter *WebRequestOnBeforeRedirectFilter, Listener WebRequestOnBeforeRedirectListener) `js:"onBeforeRedirect"`
	// The listener will be called with listener(details) when a request is completed.
	OnCompleted func(Filter *WebRequestOnCompletedFilter, Listener WebRequestOnCompletedListener) `js:"onCompleted"`
	// The listener will be called with listener(details) when an error occurs.
	OnErrorOccurred func(Filter *WebRequestOnErrorOccurredFilter, Listener WebRequestOnErrorOccurredListener) `js:"onErrorOccurred"`
}

WebRequest version@1.4.15

Intercept and modify the contents of a request at various stages of its lifetime.

func WrapWebRequest

func WrapWebRequest(o *js.Object) *WebRequest

type WebRequestCallbackResponse

type WebRequestCallbackResponse struct {
	*js.Object
	Cancel bool `js:"cancel"`
	// The original request is prevented from being sent or completed and is instead redirected to the given URL.
	RedirectURL string `js:"redirectURL"`
}

type WebRequestDetailsRequestHeaders

type WebRequestDetailsRequestHeaders struct {
	*js.Object
}

type WebRequestDetailsResponseHeaders

type WebRequestDetailsResponseHeaders struct {
	*js.Object
}

type WebRequestDetailsResponseHeaders2

type WebRequestDetailsResponseHeaders2 struct {
	*js.Object
}

type WebRequestDetailsResponseHeaders3

type WebRequestDetailsResponseHeaders3 struct {
	*js.Object
}

type WebRequestListenerCallback

type WebRequestListenerCallback func(Response *WebRequestCallbackResponse)

type WebRequestListenerDetails

type WebRequestListenerDetails struct {
	*js.Object
	Id           int64      `js:"id"`
	URL          string     `js:"url"`
	Method       string     `js:"method"`
	ResourceType string     `js:"resourceType"`
	Timestamp    float64    `js:"timestamp"`
	UploadData   *js.Object `js:"uploadData"`
}

type WebRequestListenerDetails2

type WebRequestListenerDetails2 struct {
	*js.Object
	Id             int64                            `js:"id"`
	URL            string                           `js:"url"`
	Method         string                           `js:"method"`
	ResourceType   string                           `js:"resourceType"`
	Timestamp      float64                          `js:"timestamp"`
	RequestHeaders *WebRequestDetailsRequestHeaders `js:"requestHeaders"`
}

type WebRequestListenerDetails3

type WebRequestListenerDetails3 struct {
	*js.Object
	Id           int64   `js:"id"`
	URL          string  `js:"url"`
	Method       string  `js:"method"`
	ResourceType string  `js:"resourceType"`
	Timestamp    float64 `js:"timestamp"`
	FromCache    bool    `js:"fromCache"`
	// The error description.
	Error string `js:"error"`
}

type WebRequestListenerDetails4

type WebRequestListenerDetails4 struct {
	*js.Object
	Id           string  `js:"id"`
	URL          string  `js:"url"`
	Method       string  `js:"method"`
	ResourceType string  `js:"resourceType"`
	Timestamp    float64 `js:"timestamp"`
	RedirectURL  string  `js:"redirectURL"`
	StatusCode   int64   `js:"statusCode"`
	// The server IP address that the request was actually sent to.
	Ip              string                            `js:"ip"`
	FromCache       bool                              `js:"fromCache"`
	ResponseHeaders *WebRequestDetailsResponseHeaders `js:"responseHeaders"`
}

type WebRequestListenerDetails5

type WebRequestListenerDetails5 struct {
	*js.Object
	Id              int64                              `js:"id"`
	URL             string                             `js:"url"`
	Method          string                             `js:"method"`
	ResourceType    string                             `js:"resourceType"`
	Timestamp       float64                            `js:"timestamp"`
	ResponseHeaders *WebRequestDetailsResponseHeaders2 `js:"responseHeaders"`
	// Indicates whether the response was fetched from disk cache.
	FromCache  bool   `js:"fromCache"`
	StatusCode int64  `js:"statusCode"`
	StatusLine string `js:"statusLine"`
}

type WebRequestListenerDetails6

type WebRequestListenerDetails6 struct {
	*js.Object
	Id              int64                              `js:"id"`
	URL             string                             `js:"url"`
	Method          string                             `js:"method"`
	ResourceType    string                             `js:"resourceType"`
	Timestamp       float64                            `js:"timestamp"`
	ResponseHeaders *WebRequestDetailsResponseHeaders3 `js:"responseHeaders"`
	FromCache       bool                               `js:"fromCache"`
	StatusCode      int64                              `js:"statusCode"`
	StatusLine      string                             `js:"statusLine"`
}

type WebRequestOnBeforeRedirectFilter

type WebRequestOnBeforeRedirectFilter struct {
	*js.Object
}

type WebRequestOnBeforeRedirectListener

type WebRequestOnBeforeRedirectListener func(Details *WebRequestListenerDetails4)

type WebRequestOnBeforeRequestFilter

type WebRequestOnBeforeRequestFilter struct {
	*js.Object
}

type WebRequestOnBeforeRequestListener

type WebRequestOnBeforeRequestListener func(Details *WebRequestListenerDetails, Callback WebRequestListenerCallback)

type WebRequestOnBeforeSendHeadersFilter

type WebRequestOnBeforeSendHeadersFilter struct {
	*js.Object
}

type WebRequestOnBeforeSendHeadersListener

type WebRequestOnBeforeSendHeadersListener func()

type WebRequestOnCompletedFilter

type WebRequestOnCompletedFilter struct {
	*js.Object
}

type WebRequestOnCompletedListener

type WebRequestOnCompletedListener func(Details *WebRequestListenerDetails6)

type WebRequestOnErrorOccurredFilter

type WebRequestOnErrorOccurredFilter struct {
	*js.Object
}

type WebRequestOnErrorOccurredListener

type WebRequestOnErrorOccurredListener func(Details *WebRequestListenerDetails3)

type WebRequestOnHeadersReceivedFilter

type WebRequestOnHeadersReceivedFilter struct {
	*js.Object
}

type WebRequestOnHeadersReceivedListener

type WebRequestOnHeadersReceivedListener func()

type WebRequestOnResponseStartedFilter

type WebRequestOnResponseStartedFilter struct {
	*js.Object
}

type WebRequestOnResponseStartedListener

type WebRequestOnResponseStartedListener func(Details *WebRequestListenerDetails5)

type WebRequestOnSendHeadersFilter

type WebRequestOnSendHeadersFilter struct {
	*js.Object
}

type WebRequestOnSendHeadersListener

type WebRequestOnSendHeadersListener func(Details *WebRequestListenerDetails2)

Directories

Path Synopsis
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL