Search e01
One query across the encyclopedia, books, dictionary, papers, Wikidata and the developer library. Every hit carries its source.
4 results across 6 corpora for exportFunction().
Developer library 4
Content scripts
": ["jquery.js", "content-script.js"] } ] ``` > [!NOTE] > Firefox provides [cloneInto()](/docs/Mozilla/Add-ons/WebExtensions/Content_scripts/cloneInto) and [exportFunction()](/docs/Mozilla/Add-ons/WebExtensions/Content_scripts/exportFunction) to enable content scripts to access JavaScript objects created by page scripts and expose their JavaScript objects to page scripts. > > See [Sharing objects with page scripts
exportFunction()
porting_functions_that_take_arguments) to understand what happens if the functions you export accept arguments. ## Syntax ```js-nolint let exportedFunction = exportFunction( func, // function targetScope, // object options // optional object ); ``` ### Parameters - `func` - : `function`. The function to export. - `targetScope` - : `object`. The object to attach the function
cloneInto()
- : `boolean`. Whether the object's functions should be cloned. Defaults to `false`. Cloned functions have the same semantics as functions exported using [`exportFunction`](/docs/Mozilla/Add-ons/WebExtensions/Content_scripts/exportFunction). See [Cloning objects that have functions](#cloning_objects_that_have_functions). - `wrapReflectors` - : `boolean`. Whether DOM objects should be passed by referen
Share objects with page scripts
jects with page scripts Firefox also provides APIs enabling content scripts to make objects available to page scripts. There are several approaches here: - [`exportFunction()`](#exportfunction): export a function to page scripts. - [`cloneInto()`](#cloneinto): export an object to page scripts. - `window.structuredClone()`: an alternative to `cloneInto` in some cases, see [`structuredClone` in content scripts](#stru