App runtime for chrome (beta) extension download






















Skip to content. Welcome What's new in Chrome extensions Getting started. What are extensions? What are themes? Frequently asked questions Extensions quality guidelines FAQ.

Extension development overview Manifest file format Architecture overview Declare permissions Design the user interface Debugging extensions Samples. Message passing Content scripts Match patterns Using promises Cross-origin isolation. Migrating from background pages to service workers. Protect user privacy Declare permissions and warn users Stay secure Accessibility a11y Localization message formats Give users options.

About Manifest V2 Getting started. Frequently asked questions. Message passing Content scripts Manage events with background scripts Match patterns Cross-origin isolation. Migrate to event-driven background scripts.

We want to hear from you! We are looking for web developers to participate in user research, product testing, discussion groups and more. Apply now to join our WebDev Insights Community. The below example shows how one can add this functionality to their extension.

The frame that opened the connection. This will only be set when tab is set. The origin of the page or frame that opened the connection. It can vary from the url property e. This is useful for identifying if the origin can be trusted if we can't immediately tell from the URL.

The tabs. Tab which opened the connection, if any. This property will only be present when the connection was opened from a tab including content scripts , and only if the receiver is an extension, not an app. The TLS channel ID of the page or frame that opened the connection, if requested by the extension or app, and if available. The URL of the page or frame that opened the connection. The reason that the event is being dispatched. An object which allows two way communication with other pages.

See Long-lived connections for more information. The name of the port, as specified in the call to runtime. Fired when the port is disconnected from the other end s. If the port is closed via disconnect , then this event is only fired on the other end. This event is fired at most once see also Port lifetime. The onDisconnect. This event is fired when postMessage is called by the other end of the port. The onMessage. Immediately disconnect the port.

Calling disconnect on an already-disconnected port has no effect. When a port is disconnected, no new events will be dispatched to this port. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via tabs.

The ID of the extension or app to connect to. If omitted, a connection will be attempted with your own extension. Required if sending messages from a web page for web messaging. Port through which messages can be sent and received. Connects to a native application in the host machine. See Native Messaging for more information.

If the background page is an event page, the system will ensure it is loaded before calling the callback. If there is no background page, an error is set. The callback parameter looks like: backgroundPage?

Returns details about the app or extension from the manifest. The object returned is a serialization of the full manifest file. It will never cause the caller page to reload. If your Extension does not declare an options page, or Chrome failed to create one for some other reason, the callback will set lastError. Reloads the app or extension. This method is not supported in kiosk mode. For kiosk mode, use chrome. Most other uses of requestUpdateCheck, such as calling it unconditionally based on a repeating timer, probably only serve to waste client, network, and server resources.

The callback parameter looks like: status: RequestUpdateCheckStatus , details? Restart the ChromeOS device when the app runs in kiosk mode after the given seconds. If called again before the time ends, the reboot will be delayed.

If called with a value of -1, the reboot will be cancelled. It's a no-op in non-kiosk mode. It's only allowed to be called repeatedly by the first extension to invoke this API. Similar to runtime. If sending to your extension, the runtime. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs. URL to be opened after the extension is uninstalled. This URL must have an http: or https: scheme.

Set an empty string to not open a new tab upon uninstallation. Called when the uninstall URL is set. If the given URL is invalid, runtime. Reloads the app or extension. This method is not supported in kiosk mode. For kiosk mode, use chrome. Most other uses of requestUpdateCheck, such as calling it unconditionally based on a repeating timer, probably only serve to waste client, network, and server resources. If an update is available, this contains more information about the available update.

Restart the ChromeOS device when the app runs in kiosk mode. Otherwise, it's no-op. Restart the ChromeOS device when the app runs in kiosk mode after the given seconds. If called again before the time ends, the reboot will be delayed.

If called with a value of -1, the reboot will be cancelled. It's a no-op in non-kiosk mode. It's only allowed to be called repeatedly by the first extension to invoke this API. Time to wait in seconds before rebooting the device, or -1 to cancel a scheduled reboot.

A callback to be invoked when a restart request was successfully rescheduled. Note that this does not connect to any listeners in a content script. Extensions may connect to content scripts embedded in tabs via tabs. The ID of the extension or app to connect to. If omitted, a connection will be attempted with your own extension. Required if sending messages from a web page for web messaging.

Will be passed into onConnect for processes that are listening for the connection event. Connects to a native application in the host machine. See Native Messaging for more information. Similar to runtime. If sending to your extension, the runtime. Note that extensions cannot send messages to content scripts using this method. To send messages to content scripts, use tabs. If you specify the responseCallback parameter, it should be a function that looks like this:.

The JSON response object sent by the handler of the message. If an error occurs while connecting to the extension, the callback will be called with no arguments and runtime. The response message sent by the native messaging host. If an error occurs while connecting to the native messaging host, the callback will be called with no arguments and runtime.

Fired when a profile that has this extension installed first starts up. This event is not fired when an incognito profile is started, even if this extension is operating in 'split' incognito mode.

Fired when the extension is first installed, when the extension is updated to a new version, and when Chrome is updated to a new version. Indicates the previous version of the extension, which has just been updated. This is present only if 'reason' is 'update'. Indicates the ID of the imported shared module extension which updated. Sent to the event page just before it is unloaded. This gives the extension opportunity to do some clean up.

Note that since the page is unloading, any asynchronous operations started while handling this event are not guaranteed to complete. If more activity for the event page occurs before it gets unloaded the onSuspendCanceled event will be sent and the page won't be unloaded.

Fired when an update is available, but isn't installed immediately because the app is currently running. If you do nothing, the update will be installed the next time the background page gets unloaded, if you want it to be installed sooner you can explicitly call chrome.



0コメント

  • 1000 / 1000