Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
backbone-adapter-javascript
Commits
20f10b52
"docs/git@git.noc.ac.uk:thopri/PyNEMO.git" did not exist on "eec647615c21e31b169cb144fcd0d8929a62efc8"
Unverified
Commit
20f10b52
authored
2 years ago
by
Dan Jones
Browse files
Options
Download
Email Patches
Plain Diff
fix: correct use of this in wrong context
parent
33f25858
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
21 deletions
+33
-21
dist/adapter.esm.js
dist/adapter.esm.js
+11
-7
dist/adapter.js
dist/adapter.js
+11
-7
src/adapter/index.js
src/adapter/index.js
+11
-7
No files found.
dist/adapter.esm.js
View file @
20f10b52
...
@@ -6,8 +6,8 @@ import axios from 'axios';
...
@@ -6,8 +6,8 @@ import axios from 'axios';
*/
*/
class
Adapter
{
class
Adapter
{
constructor
(
protocol
,
config
)
{
constructor
(
protocol
,
config
)
{
this
.
config
=
config
;
this
.
protocol
=
protocol
;
this
.
protocol
=
protocol
;
this
.
config
=
config
;
this
.
axios
=
axios
;
this
.
axios
=
axios
;
this
.
validator
=
new
Validator
(
protocol
.
schema
);
this
.
validator
=
new
Validator
(
protocol
.
schema
);
this
.
auth
();
this
.
auth
();
...
@@ -68,11 +68,12 @@ class Adapter {
...
@@ -68,11 +68,12 @@ class Adapter {
* @returns {object}
* @returns {object}
*/
*/
auth
()
{
auth
()
{
let
config
=
this
.
config
;
return
this
.
axios
return
this
.
axios
.
get
(
`
${
this
.
config
.
api
}
/token`
,
{
.
get
(
`
${
config
.
api
}
/token`
,
{
params
:
{
params
:
{
client_id
:
this
.
config
.
client_id
,
client_id
:
config
.
client_id
,
secret
:
this
.
config
.
secret
,
secret
:
config
.
secret
,
},
},
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
...
@@ -88,9 +89,10 @@ class Adapter {
...
@@ -88,9 +89,10 @@ class Adapter {
* @returns {object}
* @returns {object}
*/
*/
poll
()
{
poll
()
{
let
config
=
this
.
config
;
return
this
.
getAuthorizationHeader
()
return
this
.
getAuthorizationHeader
()
.
then
((
headers
)
=>
{
.
then
((
headers
)
=>
{
return
this
.
axios
.
get
(
`
${
this
.
config
.
api
}
/receive`
,
{
return
this
.
axios
.
get
(
`
${
config
.
api
}
/receive`
,
{
headers
,
headers
,
});
});
})
})
...
@@ -116,10 +118,11 @@ class Adapter {
...
@@ -116,10 +118,11 @@ class Adapter {
* @returns
* @returns
*/
*/
publish
(
topic
,
body
)
{
publish
(
topic
,
body
)
{
let
config
=
this
.
config
;
return
this
.
getAuthorizationHeader
()
return
this
.
getAuthorizationHeader
()
.
then
((
headers
)
=>
{
.
then
((
headers
)
=>
{
return
this
.
axios
.
post
(
return
this
.
axios
.
post
(
`
${
this
.
config
.
api
}
/send`
,
`
${
config
.
api
}
/send`
,
{
{
topic
,
topic
,
body
,
body
,
...
@@ -146,10 +149,11 @@ class Adapter {
...
@@ -146,10 +149,11 @@ class Adapter {
* @returns
* @returns
*/
*/
broadcast
(
body
)
{
broadcast
(
body
)
{
let
config
=
this
.
config
;
return
this
.
getAuthorizationHeader
()
return
this
.
getAuthorizationHeader
()
.
then
((
headers
)
=>
{
.
then
((
headers
)
=>
{
return
this
.
axios
.
post
(
return
this
.
axios
.
post
(
`
${
this
.
config
.
api
}
/notify`
,
`
${
config
.
api
}
/notify`
,
{
{
body
,
body
,
},
},
...
...
This diff is collapsed.
Click to expand it.
dist/adapter.js
View file @
20f10b52
...
@@ -8,8 +8,8 @@ var axios = require('axios');
...
@@ -8,8 +8,8 @@ var axios = require('axios');
*/
*/
class
Adapter
{
class
Adapter
{
constructor
(
protocol
,
config
)
{
constructor
(
protocol
,
config
)
{
this
.
config
=
config
;
this
.
protocol
=
protocol
;
this
.
protocol
=
protocol
;
this
.
config
=
config
;
this
.
axios
=
axios
;
this
.
axios
=
axios
;
this
.
validator
=
new
Validator
(
protocol
.
schema
);
this
.
validator
=
new
Validator
(
protocol
.
schema
);
this
.
auth
();
this
.
auth
();
...
@@ -70,11 +70,12 @@ class Adapter {
...
@@ -70,11 +70,12 @@ class Adapter {
* @returns {object}
* @returns {object}
*/
*/
auth
()
{
auth
()
{
let
config
=
this
.
config
;
return
this
.
axios
return
this
.
axios
.
get
(
`
${
this
.
config
.
api
}
/token`
,
{
.
get
(
`
${
config
.
api
}
/token`
,
{
params
:
{
params
:
{
client_id
:
this
.
config
.
client_id
,
client_id
:
config
.
client_id
,
secret
:
this
.
config
.
secret
,
secret
:
config
.
secret
,
},
},
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
...
@@ -90,9 +91,10 @@ class Adapter {
...
@@ -90,9 +91,10 @@ class Adapter {
* @returns {object}
* @returns {object}
*/
*/
poll
()
{
poll
()
{
let
config
=
this
.
config
;
return
this
.
getAuthorizationHeader
()
return
this
.
getAuthorizationHeader
()
.
then
((
headers
)
=>
{
.
then
((
headers
)
=>
{
return
this
.
axios
.
get
(
`
${
this
.
config
.
api
}
/receive`
,
{
return
this
.
axios
.
get
(
`
${
config
.
api
}
/receive`
,
{
headers
,
headers
,
});
});
})
})
...
@@ -118,10 +120,11 @@ class Adapter {
...
@@ -118,10 +120,11 @@ class Adapter {
* @returns
* @returns
*/
*/
publish
(
topic
,
body
)
{
publish
(
topic
,
body
)
{
let
config
=
this
.
config
;
return
this
.
getAuthorizationHeader
()
return
this
.
getAuthorizationHeader
()
.
then
((
headers
)
=>
{
.
then
((
headers
)
=>
{
return
this
.
axios
.
post
(
return
this
.
axios
.
post
(
`
${
this
.
config
.
api
}
/send`
,
`
${
config
.
api
}
/send`
,
{
{
topic
,
topic
,
body
,
body
,
...
@@ -148,10 +151,11 @@ class Adapter {
...
@@ -148,10 +151,11 @@ class Adapter {
* @returns
* @returns
*/
*/
broadcast
(
body
)
{
broadcast
(
body
)
{
let
config
=
this
.
config
;
return
this
.
getAuthorizationHeader
()
return
this
.
getAuthorizationHeader
()
.
then
((
headers
)
=>
{
.
then
((
headers
)
=>
{
return
this
.
axios
.
post
(
return
this
.
axios
.
post
(
`
${
this
.
config
.
api
}
/notify`
,
`
${
config
.
api
}
/notify`
,
{
{
body
,
body
,
},
},
...
...
This diff is collapsed.
Click to expand it.
src/adapter/index.js
View file @
20f10b52
...
@@ -6,8 +6,8 @@ import axios from 'axios';
...
@@ -6,8 +6,8 @@ import axios from 'axios';
*/
*/
export
class
Adapter
{
export
class
Adapter
{
constructor
(
protocol
,
config
)
{
constructor
(
protocol
,
config
)
{
this
.
config
=
config
;
this
.
protocol
=
protocol
;
this
.
protocol
=
protocol
;
this
.
config
=
config
;
this
.
axios
=
axios
;
this
.
axios
=
axios
;
this
.
validator
=
new
Validator
(
protocol
.
schema
);
this
.
validator
=
new
Validator
(
protocol
.
schema
);
this
.
auth
();
this
.
auth
();
...
@@ -68,11 +68,12 @@ export class Adapter {
...
@@ -68,11 +68,12 @@ export class Adapter {
* @returns {object}
* @returns {object}
*/
*/
auth
()
{
auth
()
{
let
config
=
this
.
config
;
return
this
.
axios
return
this
.
axios
.
get
(
`
${
this
.
config
.
api
}
/token`
,
{
.
get
(
`
${
config
.
api
}
/token`
,
{
params
:
{
params
:
{
client_id
:
this
.
config
.
client_id
,
client_id
:
config
.
client_id
,
secret
:
this
.
config
.
secret
,
secret
:
config
.
secret
,
},
},
})
})
.
then
((
response
)
=>
{
.
then
((
response
)
=>
{
...
@@ -88,9 +89,10 @@ export class Adapter {
...
@@ -88,9 +89,10 @@ export class Adapter {
* @returns {object}
* @returns {object}
*/
*/
poll
()
{
poll
()
{
let
config
=
this
.
config
;
return
this
.
getAuthorizationHeader
()
return
this
.
getAuthorizationHeader
()
.
then
((
headers
)
=>
{
.
then
((
headers
)
=>
{
return
this
.
axios
.
get
(
`
${
this
.
config
.
api
}
/receive`
,
{
return
this
.
axios
.
get
(
`
${
config
.
api
}
/receive`
,
{
headers
,
headers
,
});
});
})
})
...
@@ -116,10 +118,11 @@ export class Adapter {
...
@@ -116,10 +118,11 @@ export class Adapter {
* @returns
* @returns
*/
*/
publish
(
topic
,
body
)
{
publish
(
topic
,
body
)
{
let
config
=
this
.
config
;
return
this
.
getAuthorizationHeader
()
return
this
.
getAuthorizationHeader
()
.
then
((
headers
)
=>
{
.
then
((
headers
)
=>
{
return
this
.
axios
.
post
(
return
this
.
axios
.
post
(
`
${
this
.
config
.
api
}
/send`
,
`
${
config
.
api
}
/send`
,
{
{
topic
,
topic
,
body
,
body
,
...
@@ -146,10 +149,11 @@ export class Adapter {
...
@@ -146,10 +149,11 @@ export class Adapter {
* @returns
* @returns
*/
*/
broadcast
(
body
)
{
broadcast
(
body
)
{
let
config
=
this
.
config
;
return
this
.
getAuthorizationHeader
()
return
this
.
getAuthorizationHeader
()
.
then
((
headers
)
=>
{
.
then
((
headers
)
=>
{
return
this
.
axios
.
post
(
return
this
.
axios
.
post
(
`
${
this
.
config
.
api
}
/notify`
,
`
${
config
.
api
}
/notify`
,
{
{
body
,
body
,
},
},
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment