Skip to content

Commit fb92aad

Browse files
authored
Merge pull request #6 from NN---/patch-1
Add JS highlighting
2 parents f5e2704 + e8c9239 commit fb92aad

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ Pre-processing is useful if you want to generate different builds from the same
126126
### weh preferences
127127

128128
Preferences are to be formally defined in order to be used in your add-on. An example of preferences description could be:
129-
```
129+
```js
130130
weh.prefs.declare([{
131131
name: "myparam_string",
132132
type: "string",
@@ -176,7 +176,7 @@ You should also define a couple of human viewable strings associated to each par
176176
- `weh_prefs_description_<parameter name>` defines an optional longer description for this parameter
177177

178178
Example (`locales/en_US/messages.json`):
179-
```
179+
```js
180180
"weh_prefs_label_myparam_string": {
181181
"message": "String parameter"
182182
},
@@ -225,7 +225,7 @@ All the functions return promises. If a declared function returns something othe
225225
Functions are declared on the called side using `weh.rpc.listen()` and are called with `weh.rpc.call()`.
226226

227227
For instance, the background can define a function like this:
228-
```
228+
```js
229229
weh.rpc.listen({
230230
my_function: (a,b) => {
231231
return a + b;
@@ -234,7 +234,7 @@ weh.rpc.listen({
234234
```
235235

236236
and a content script can call the function this way:
237-
```
237+
```js
238238
weh.call("my_function",39,3)
239239
.then((result)=>{
240240
console.info("=",result);
@@ -251,7 +251,7 @@ If the called function does not exists, throw an exception or return explicitly
251251

252252
*weh* is also very useful when dealing with native messaging.
253253

254-
```
254+
```js
255255
var nativeApp = require('weh-natmsg')("com.example.myapp");
256256

257257
nativeApp.call("my_function",...params)
@@ -264,14 +264,14 @@ nativeApp.call("my_function",...params)
264264
```
265265

266266
You can catch all errors due to the native app not being installed (or at least not being callable):
267-
```
267+
```js
268268
nativeApp.onAppNotFound.addListener((err)=>{
269269
// for instance, open a tab to a site where to download the app
270270
})
271271
```
272272

273273
You can just check whether the app is present, without triggering the `onAppNotFound()` if it is not:
274-
```
274+
```js
275275
nativeApp.callCatchAppNotFound((err)=>{
276276
// this is called if the app could not be launched
277277
},"my_function",...params);
@@ -285,7 +285,7 @@ For now, the only implementation of such a native is available on the [`vdhcoapp
285285

286286
`weh.ui` provides the ability to open a tab or a panel, so that the created content can directly be callable from the background using `weh.rpc`.
287287

288-
```
288+
```js
289289
weh.ui.open("some_name",{
290290
url: "content/content.html",
291291
type: "tab"

0 commit comments

Comments
 (0)