summaryrefslogtreecommitdiff
path: root/data/extensions/jid1-KtlZuoiikVfFew@jetpack/node_modules/pathfinder/docs/userscript.md
blob: 1bc8d4e4a4aaf5244d674846aad792dc5aee8bb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<!-- contributed by Erik Vold [erikvvold@gmail.com]  -->

The `userscript` module allows modules to create user scripts which automatically
start running on windows opened after the user script is created.


## Example ##
    var scripts = ["test.user.js"];
    var self = require("self");
    var {UserScript} = require("userscript");
    exports.main = function() {
      scripts.forEach(function(scriptName, index) {
        UserScript(self.data.url(scriptName));
      });
    };


<api name="UserScript">
@class

The module exports a `UserScript` constructor which allowing one to create a
user script.

<api name="UserScript">
@constructor
Creates a user script.

@param aURL {String}
  The url of a user script on the local file system, so this url can be a
  `resource:`, `file:`, or `chrome:` for example.
</api>

<api name="enabled">
@property {Boolean}
Allows one to get and change the status of the a user script. A disabled user
script will not be injected in to newly opened windows.
</api>

<api name="destroy">
@method
The user script will no longer be injected into new windows, you will have to
create a new user script in order to run the script again.
</api>
</api>