Skip to content

Commit 9eec312

Browse files
authored
Merge pull request #9 from anthonny/master
fix(deps): switch to nativescript-socketio and fix toaster
2 parents 44158a7 + 718314e commit 9eec312

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

Diff for: index.js

+15-4
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,30 @@ function getServerIpAddress(host, port) {
4545
return `127.0.0.1:${port}`
4646
}
4747

48+
// Wrap the toast message in a try, devtool still work without toaster
49+
const showToast = (message) => {
50+
try {
51+
const Toasty = require('nativescript-toasty').Toasty;
52+
new Toasty(message).show();
53+
} catch (error) {
54+
console.log(error);
55+
}
56+
}
57+
4858
module.exports = function install(Vue, {debug = false, host = null, port = 8098} = {}) {
4959
const startApp = Vue.prototype.$start
5060

5161
Vue.prototype.$start = function () {
5262
const setupDevtools = () => {
5363
devtools.connect('ws://localhost', port, {
5464
app: this,
55-
showToast: (message) => require('nativescript-toast').makeText(message).show(),
65+
showToast,
5666
io() {
5767
const address = `http://${getServerIpAddress(host, port)}`
58-
const SocketIO = require('nativescript-socket.io')
59-
debug && SocketIO.enableDebug()
60-
return SocketIO.connect(address)
68+
const SocketIO = require('nativescript-socketio').SocketIO
69+
let socketIO = new SocketIO(address, { debug: debug })
70+
socketIO.connect()
71+
return socketIO
6172
}
6273
})
6374

Diff for: package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nativescript-vue-devtools",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "A NativeScript-Vue plugin for connecting to the standalone vue-devtools",
55
"main": "index.js",
66
"scripts": {
@@ -27,8 +27,8 @@
2727
},
2828
"homepage": "https://github.com/nativescript-vue/nativescript-vue-devtools#readme",
2929
"peerDependencies": {
30-
"nativescript-toast": "*",
31-
"nativescript-socket.io": "*",
30+
"nativescript-toasty": "*",
31+
"nativescript-socketio": "*",
3232
"tns-core-modules": "*",
3333
"@vue/devtools": "*"
3434
}

0 commit comments

Comments
 (0)