You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 26, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: docs/writing-an-intent.md
+20-20Lines changed: 20 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,7 +64,7 @@ intentRunner.registerIntent({
64
64
65
65
Some things to note:
66
66
67
-
- We use [JavaScript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) in most of the extension (except for content scripts).
67
+
- We use [JavaScript modules](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) in most of the extension
68
68
- Intents often don't actually export anything, they work by calling `intentRunner.register()`. But you can [export](https://developer.mozilla.org/en-US/docs/web/javascript/reference/statements/export) if you want.
69
69
- We use [eslint](https://eslint.org/) in the codebase, and it's recommended you configure your editor to show warnings.
70
70
- You can (and usually will) have multiple intents in a single module and config file (e.g., `someIntent.otherCommand` and so on)
@@ -95,7 +95,7 @@ Patterns have words, words with alternatives, slots, typed slots, and parameters
95
95
96
96
**Typed slots:** these are things like `[service:musicServiceName]`. These "types" are lists of specific strings. These types are in the `background/entityTypes.js` module. Right now this system isn't very extensible.
97
97
98
-
**Parameters:** sometimes you care _which_ phrase is matched, not just a slot. If you include `[param=value]` then `contents.parameters.param === "value"` (if that specific phrase is matched). You can see an example in [`extensions/intents/music/music.js`](https://github.com/mozilla/firefox-voice/blob/master/extension/intents/music/music.js) in `music.move`.
98
+
**Parameters:** sometimes you care _which_ phrase is matched, not just a slot. If you include `[param=value]` then `context.parameters.param === "value"` (if that specific phrase is matched). You can see an example in [`extensions/intents/music/music.js`](https://github.com/mozilla/firefox-voice/blob/master/extension/intents/music/music.js) in `music.move`.
99
99
100
100
### Matching an utterance to an intent
101
101
@@ -138,38 +138,38 @@ To prepare a tab to do your custom stuff, run:
`content.inject` will make sure the script is available and fully loaded, and will not re-load the script if called multiple times on the same tab. It also loads [`content/communicate.js`](../extension/content/communicate.js) and [`content/helpers.js`](../extension/content/helpers.js).
147
+
`content.inject` will load the built script (scripts like these are packaged up into `someScript.bundle.js`). These scripts _must_ be named with `.content.js`.
148
148
149
-
You can use this pattern in your script (`contentScript.js` in this example):
149
+
You can use this pattern in your script (`someScript.content.js` in this example):
0 commit comments