Liking cljdoc? Tell your friends :D

chromex.ext.downloads

clj

Use the chrome.downloads API to programmatically initiate, monitor, manipulate, and search for downloads.

Use the chrome.downloads API to programmatically initiate,
monitor, manipulate, and search for downloads.

  * available since Chrome 31
  * https://developer.chrome.com/extensions/downloads
raw docstring

accept-dangerclj/smacro

(accept-danger download-id)

Prompt the user to accept a dangerous download. Can only be called from a visible context (tab, window, or page/browser action popup). Does not automatically accept dangerous downloads. If the download is accepted, then an 'onChanged' event will fire, otherwise nothing will happen. When all the data is fetched into a temporary file and either the download is not dangerous or the danger has been accepted, then the temporary file is renamed to the target filename, the |state| changes to 'complete', and 'onChanged' fires.

|download-id| - The identifier for the 'DownloadItem'.

This function returns a core.async channel of type promise-chan which eventually receives a result value. Signature of the result value put on the channel is [].

In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-acceptDanger.

Prompt the user to accept a dangerous download. Can only be called from a visible context (tab, window, or page/browser
action popup). Does not automatically accept dangerous downloads. If the download is accepted, then an 'onChanged' event
will fire, otherwise nothing will happen. When all the data is fetched into a temporary file and either the download is not
dangerous or the danger has been accepted, then the temporary file is renamed to the target filename, the |state| changes
to 'complete', and 'onChanged' fires.

  |download-id| - The identifier for the 'DownloadItem'.

This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].

In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-acceptDanger.
sourceraw docstring

accept-danger*cljs

(accept-danger* config download-id)
source

api-tableclj

source

cancelclj/smacro

(cancel download-id)

Cancel a download. When callback is run, the download is cancelled, completed, interrupted or doesn't exist anymore.

|download-id| - The id of the download to cancel.

This function returns a core.async channel of type promise-chan which eventually receives a result value. Signature of the result value put on the channel is [].

In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-cancel.

Cancel a download. When callback is run, the download is cancelled, completed, interrupted or doesn't exist anymore.

  |download-id| - The id of the download to cancel.

This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].

In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-cancel.
sourceraw docstring

cancel*cljs

(cancel* config download-id)
source

downloadclj/smacro

(download options)

Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the specified filename. If the download started successfully, callback will be called with the new 'DownloadItem''s downloadId. If there was an error starting the download, then callback will be called with downloadId=undefined and 'runtime.lastError' will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases. Extensions must not parse it.

|options| - What to download and how.

This function returns a core.async channel of type promise-chan which eventually receives a result value. Signature of the result value put on the channel is [download-id] where:

|download-id| - https://developer.chrome.com/extensions/downloads#property-callback-downloadId.

In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-download.

Download a URL. If the URL uses the HTTP[S] protocol, then the request will include all cookies currently set for its
hostname. If both filename and saveAs are specified, then the Save As dialog will be displayed, pre-populated with the
specified filename. If the download started successfully, callback will be called with the new 'DownloadItem''s downloadId.
If there was an error starting the download, then callback will be called with downloadId=undefined and 'runtime.lastError'
will contain a descriptive string. The error strings are not guaranteed to remain backwards compatible between releases.
Extensions must not parse it.

  |options| - What to download and how.

This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [download-id] where:

  |download-id| - https://developer.chrome.com/extensions/downloads#property-callback-downloadId.

In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-download.
sourceraw docstring

download*cljs

(download* config options)
source

dragclj/smacro

(drag download-id)

Initiate dragging the downloaded file to another application. Call in a javascript ondragstart handler.

|download-id| - https://developer.chrome.com/extensions/downloads#property-drag-downloadId.

https://developer.chrome.com/extensions/downloads#method-drag.

Initiate dragging the downloaded file to another application. Call in a javascript ondragstart handler.

  |download-id| - https://developer.chrome.com/extensions/downloads#property-drag-downloadId.

https://developer.chrome.com/extensions/downloads#method-drag.
sourceraw docstring

drag*cljs

(drag* config download-id)
source

eraseclj/smacro

(erase query)

Erase matching 'DownloadItem' from history without deleting the downloaded file. An 'onErased' event will fire for each 'DownloadItem' that matches query, then callback will be called.

|query| - https://developer.chrome.com/extensions/downloads#property-erase-query.

This function returns a core.async channel of type promise-chan which eventually receives a result value. Signature of the result value put on the channel is [erased-ids] where:

|erased-ids| - https://developer.chrome.com/extensions/downloads#property-callback-erasedIds.

In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-erase.

Erase matching 'DownloadItem' from history without deleting the downloaded file. An 'onErased' event will fire for each
'DownloadItem' that matches query, then callback will be called.

  |query| - https://developer.chrome.com/extensions/downloads#property-erase-query.

This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [erased-ids] where:

  |erased-ids| - https://developer.chrome.com/extensions/downloads#property-callback-erasedIds.

In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-erase.
sourceraw docstring

erase*cljs

(erase* config query)
source

gen-callclj

source

gen-wrapclj/smacro

(gen-wrap kind item-id config & args)
source

get-file-iconclj/smacro

(get-file-icon download-id)
(get-file-icon download-id options)

Retrieve an icon for the specified download. For new downloads, file icons are available after the 'onCreated' event has been received. The image returned by this function while a download is in progress may be different from the image returned after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on the platform. The icon that is returned will therefore depend on a number of factors including state of the download, platform, registered file types and visual theme. If a file icon cannot be determined, 'runtime.lastError' will contain an error message.

|download-id| - The identifier for the download. |options| - https://developer.chrome.com/extensions/downloads#property-getFileIcon-options.

This function returns a core.async channel of type promise-chan which eventually receives a result value. Signature of the result value put on the channel is [icon-url] where:

|icon-url| - https://developer.chrome.com/extensions/downloads#property-callback-iconURL.

In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-getFileIcon.

Retrieve an icon for the specified download. For new downloads, file icons are available after the 'onCreated' event has
been received. The image returned by this function while a download is in progress may be different from the image returned
after the download is complete. Icon retrieval is done by querying the underlying operating system or toolkit depending on
the platform. The icon that is returned will therefore depend on a number of factors including state of the download,
platform, registered file types and visual theme. If a file icon cannot be determined, 'runtime.lastError' will contain an
error message.

  |download-id| - The identifier for the download.
  |options| - https://developer.chrome.com/extensions/downloads#property-getFileIcon-options.

This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [icon-url] where:

  |icon-url| - https://developer.chrome.com/extensions/downloads#property-callback-iconURL.

In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-getFileIcon.
sourceraw docstring

get-file-icon*cljs

(get-file-icon* config download-id options)
source

on-changed*cljs

(on-changed* config channel & args)
source

on-created*cljs

(on-created* config channel & args)
source

on-determining-filename*cljs

(on-determining-filename* config channel & args)
source

on-erased*cljs

(on-erased* config channel & args)
source

openclj/smacro

(open download-id)

Open the downloaded file now if the 'DownloadItem' is complete; otherwise returns an error through 'runtime.lastError'. Requires the 'downloads.open' permission in addition to the 'downloads' permission. An 'onChanged' event will fire when the item is opened for the first time.

|download-id| - The identifier for the downloaded file.

https://developer.chrome.com/extensions/downloads#method-open.

Open the downloaded file now if the 'DownloadItem' is complete; otherwise returns an error through 'runtime.lastError'.
Requires the 'downloads.open' permission in addition to the 'downloads' permission. An 'onChanged' event will fire when the
item is opened for the first time.

  |download-id| - The identifier for the downloaded file.

https://developer.chrome.com/extensions/downloads#method-open.
sourceraw docstring

open*cljs

(open* config download-id)
source

pauseclj/smacro

(pause download-id)

Pause the download. If the request was successful the download is in a paused state. Otherwise 'runtime.lastError' contains an error message. The request will fail if the download is not active.

|download-id| - The id of the download to pause.

This function returns a core.async channel of type promise-chan which eventually receives a result value. Signature of the result value put on the channel is [].

In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-pause.

Pause the download. If the request was successful the download is in a paused state. Otherwise 'runtime.lastError' contains
an error message. The request will fail if the download is not active.

  |download-id| - The id of the download to pause.

This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].

In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-pause.
sourceraw docstring

pause*cljs

(pause* config download-id)
source

remove-fileclj/smacro

(remove-file download-id)

Remove the downloaded file if it exists and the 'DownloadItem' is complete; otherwise return an error through 'runtime.lastError'.

|download-id| - https://developer.chrome.com/extensions/downloads#property-removeFile-downloadId.

This function returns a core.async channel of type promise-chan which eventually receives a result value. Signature of the result value put on the channel is [].

In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-removeFile.

Remove the downloaded file if it exists and the 'DownloadItem' is complete; otherwise return an error through
'runtime.lastError'.

  |download-id| - https://developer.chrome.com/extensions/downloads#property-removeFile-downloadId.

This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].

In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-removeFile.
sourceraw docstring

remove-file*cljs

(remove-file* config download-id)
source

resumeclj/smacro

(resume download-id)

Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise 'runtime.lastError' contains an error message. The request will fail if the download is not active.

|download-id| - The id of the download to resume.

This function returns a core.async channel of type promise-chan which eventually receives a result value. Signature of the result value put on the channel is [].

In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-resume.

Resume a paused download. If the request was successful the download is in progress and unpaused. Otherwise
'runtime.lastError' contains an error message. The request will fail if the download is not active.

  |download-id| - The id of the download to resume.

This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [].

In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-resume.
sourceraw docstring

resume*cljs

(resume* config download-id)
source

(search query)

Find 'DownloadItem'. Set query to the empty object to get all 'DownloadItem'. To get a specific 'DownloadItem', set only the id field. To page through a large number of items, set orderBy: ['-startTime'], set limit to the number of items per page, and set startedAfter to the startTime of the last item from the last page.

|query| - https://developer.chrome.com/extensions/downloads#property-search-query.

This function returns a core.async channel of type promise-chan which eventually receives a result value. Signature of the result value put on the channel is [results] where:

|results| - https://developer.chrome.com/extensions/downloads#property-callback-results.

In case of an error the channel closes without receiving any value and relevant error object can be obtained via chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-search.

Find 'DownloadItem'. Set query to the empty object to get all 'DownloadItem'. To get a specific 'DownloadItem', set only
the id field. To page through a large number of items, set orderBy: ['-startTime'], set limit to the number of items per
page, and set startedAfter to the startTime of the last item from the last page.

  |query| - https://developer.chrome.com/extensions/downloads#property-search-query.

This function returns a core.async channel of type `promise-chan` which eventually receives a result value.
Signature of the result value put on the channel is [results] where:

  |results| - https://developer.chrome.com/extensions/downloads#property-callback-results.

In case of an error the channel closes without receiving any value and relevant error object can be obtained via
chromex.error/get-last-error.

https://developer.chrome.com/extensions/downloads#method-search.
sourceraw docstring

search*cljs

(search* config query)
source

set-shelf-enabledclj/smacro

(set-shelf-enabled enabled)

Enable or disable the gray shelf at the bottom of every window associated with the current browser profile. The shelf will be disabled as long as at least one extension has disabled it. Enabling the shelf while at least one other extension has disabled it will return an error through 'runtime.lastError'. Requires the 'downloads.shelf' permission in addition to the 'downloads' permission.

|enabled| - https://developer.chrome.com/extensions/downloads#property-setShelfEnabled-enabled.

https://developer.chrome.com/extensions/downloads#method-setShelfEnabled.

Enable or disable the gray shelf at the bottom of every window associated with the current browser profile. The shelf will
be disabled as long as at least one extension has disabled it. Enabling the shelf while at least one other extension has
disabled it will return an error through 'runtime.lastError'. Requires the 'downloads.shelf' permission in addition to the
'downloads' permission.

  |enabled| - https://developer.chrome.com/extensions/downloads#property-setShelfEnabled-enabled.

https://developer.chrome.com/extensions/downloads#method-setShelfEnabled.
sourceraw docstring

set-shelf-enabled*cljs

(set-shelf-enabled* config enabled)
source

showclj/smacro

(show download-id)

Show the downloaded file in its folder in a file manager.

|download-id| - The identifier for the downloaded file.

https://developer.chrome.com/extensions/downloads#method-show.

Show the downloaded file in its folder in a file manager.

  |download-id| - The identifier for the downloaded file.

https://developer.chrome.com/extensions/downloads#method-show.
sourceraw docstring

show*cljs

(show* config download-id)
source

show-default-folderclj/smacro

(show-default-folder)

Show the default Downloads folder in a file manager.

https://developer.chrome.com/extensions/downloads#method-showDefaultFolder.

Show the default Downloads folder in a file manager.

https://developer.chrome.com/extensions/downloads#method-showDefaultFolder.
sourceraw docstring

show-default-folder*cljs

(show-default-folder* config)
source

tap-all-eventsclj/smacro

(tap-all-events chan)

Taps all valid non-deprecated events in chromex.ext.downloads namespace.

Taps all valid non-deprecated events in chromex.ext.downloads namespace.
sourceraw docstring

tap-on-changed-eventsclj/smacro

(tap-on-changed-events channel & args)

When any of a 'DownloadItem''s properties except bytesReceived and estimatedEndTime changes, this event fires with the downloadId and an object containing the properties that changed.

Events will be put on the |channel| with signature [::on-changed [download-delta]] where:

|download-delta| - https://developer.chrome.com/extensions/downloads#property-onChanged-downloadDelta.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/extensions/downloads#event-onChanged.

When any of a 'DownloadItem''s properties except bytesReceived and estimatedEndTime changes, this event fires with the
downloadId and an object containing the properties that changed.

Events will be put on the |channel| with signature [::on-changed [download-delta]] where:

  |download-delta| - https://developer.chrome.com/extensions/downloads#property-onChanged-downloadDelta.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/extensions/downloads#event-onChanged.
sourceraw docstring

tap-on-created-eventsclj/smacro

(tap-on-created-events channel & args)

This event fires with the 'DownloadItem' object when a download begins.

Events will be put on the |channel| with signature [::on-created [download-item]] where:

|download-item| - https://developer.chrome.com/extensions/downloads#property-onCreated-downloadItem.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/extensions/downloads#event-onCreated.

This event fires with the 'DownloadItem' object when a download begins.

Events will be put on the |channel| with signature [::on-created [download-item]] where:

  |download-item| - https://developer.chrome.com/extensions/downloads#property-onCreated-downloadItem.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/extensions/downloads#event-onCreated.
sourceraw docstring

tap-on-determining-filename-eventsclj/smacro

(tap-on-determining-filename-events channel & args)

During the filename determination process, extensions will be given the opportunity to override the target 'DownloadItem.filename'. Each extension may not register more than one listener for this event. Each listener must call suggest exactly once, either synchronously or asynchronously. If the listener calls suggest asynchronously, then it must return true. If the listener neither calls suggest synchronously nor returns true, then suggest will be called automatically. The 'DownloadItem' will not complete until all listeners have called suggest. Listeners may call suggest without any arguments in order to allow the download to use downloadItem.filename for its filename, or pass a suggestion object to suggest in order to override the target filename. If more than one extension overrides the filename, then the last extension installed whose listener passes a suggestion object to suggest wins. In order to avoid confusion regarding which extension will win, users should not install extensions that may conflict. If the download is initiated by 'download' and the target filename is known before the MIME type and tentative filename have been determined, pass filename to 'download' instead.

Events will be put on the |channel| with signature [::on-determining-filename [download-item suggest]] where:

|download-item| - https://developer.chrome.com/extensions/downloads#property-onDeterminingFilename-downloadItem.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/extensions/downloads#event-onDeterminingFilename.

During the filename determination process, extensions will be given the opportunity to override the target
'DownloadItem.filename'. Each extension may not register more than one listener for this event. Each listener must call
suggest exactly once, either synchronously or asynchronously. If the listener calls suggest asynchronously, then it must
return true. If the listener neither calls suggest synchronously nor returns true, then suggest will be called
automatically. The 'DownloadItem' will not complete until all listeners have called suggest. Listeners may call suggest
without any arguments in order to allow the download to use downloadItem.filename for its filename, or pass a suggestion
object to suggest in order to override the target filename. If more than one extension overrides the filename, then the
last extension installed whose listener passes a suggestion object to suggest wins. In order to avoid confusion regarding
which extension will win, users should not install extensions that may conflict. If the download is initiated by 'download'
and the target filename is known before the MIME type and tentative filename have been determined, pass filename to
'download' instead.

Events will be put on the |channel| with signature [::on-determining-filename [download-item suggest]] where:

  |download-item| - https://developer.chrome.com/extensions/downloads#property-onDeterminingFilename-downloadItem.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/extensions/downloads#event-onDeterminingFilename.
sourceraw docstring

tap-on-erased-eventsclj/smacro

(tap-on-erased-events channel & args)

Fires with the downloadId when a download is erased from history.

Events will be put on the |channel| with signature [::on-erased [download-id]] where:

|download-id| - The id of the 'DownloadItem' that was erased.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/extensions/downloads#event-onErased.

Fires with the downloadId when a download is erased from history.

Events will be put on the |channel| with signature [::on-erased [download-id]] where:

  |download-id| - The id of the 'DownloadItem' that was erased.

Note: |args| will be passed as additional parameters into Chrome event's .addListener call.

https://developer.chrome.com/extensions/downloads#event-onErased.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close