Skip to content

Commit 0f8ddfc

Browse files
committed
code standardized
1 parent 4f176e8 commit 0f8ddfc

4 files changed

Lines changed: 720 additions & 745 deletions

File tree

example.js

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,23 @@
11
// Initialize WebHooks module.
2-
var WebHooks = require('./index');
3-
2+
var WebHooks = require('./index')
43

54
var webHooks = new WebHooks({
6-
db: './webHooksDB.json' // json file that store webhook URLs
7-
});
5+
db: './webHooksDB.json' // json file that store webhook URLs
6+
})
87

98
// sync instantation - add a new webhook called 'shortname1'
10-
webHooks.add('shortname1', 'http://127.0.0.1:9000/prova/other_url').then(function(){
11-
// done
12-
}).catch(function(err){
13-
console.log(err);
14-
});
9+
webHooks.add('shortname1', 'http://127.0.0.1:9000/prova/other_url').then(function () {
10+
// done
11+
}).catch(function (err) {
12+
console.log(err)
13+
})
1514

1615
// add another webHook
17-
webHooks.add('shortname2', 'http://127.0.0.1:9000/prova2/').then(function(){
18-
// done
19-
}).catch(function(err){
20-
console.log(err);
21-
});
16+
webHooks.add('shortname2', 'http://127.0.0.1:9000/prova2/').then(function () {
17+
// done
18+
}).catch(function (err) {
19+
console.log(err)
20+
})
2221

2322
// remove a single url attached to the given shortname
2423
// webHooks.remove('shortname3', 'http://127.0.0.1:9000/query/').catch(function(err){console.error(err);});
@@ -27,5 +26,5 @@ webHooks.add('shortname2', 'http://127.0.0.1:9000/prova2/').then(function(){
2726
// webHooks.remove('shortname3').catch(function(err){console.error(err);});
2827

2928
// trigger a specific webHook
30-
webHooks.trigger('shortname1', {data: 123});
31-
webHooks.trigger('shortname2', {data: 123456}, {header: 'header'}); // payload will be sent as POST request with JSON body (Content-Type: application/json) and custom header
29+
webHooks.trigger('shortname1', {data: 123})
30+
webHooks.trigger('shortname2', {data: 123456}, {header: 'header'}) // payload will be sent as POST request with JSON body (Content-Type: application/json) and custom header

0 commit comments

Comments
 (0)