Skip to content

fix(deps): switch to nativescript-socketio and fix toaster #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,30 @@ function getServerIpAddress(host, port) {
return `127.0.0.1:${port}`
}

// Wrap the toast message in a try, devtool still work without toaster
const showToast = (message) => {
try {
const Toasty = require('nativescript-toasty').Toasty;
new Toasty(message).show();
} catch (error) {
console.log(error);
}
}

module.exports = function install(Vue, {debug = false, host = null, port = 8098} = {}) {
const startApp = Vue.prototype.$start

Vue.prototype.$start = function () {
const setupDevtools = () => {
devtools.connect('ws://localhost', port, {
app: this,
showToast: (message) => require('nativescript-toast').makeText(message).show(),
showToast,
io() {
const address = `http://${getServerIpAddress(host, port)}`
const SocketIO = require('nativescript-socket.io')
debug && SocketIO.enableDebug()
return SocketIO.connect(address)
const SocketIO = require('nativescript-socketio').SocketIO
let socketIO = new SocketIO(address, { debug: debug })
socketIO.connect()
return socketIO
}
})

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nativescript-vue-devtools",
"version": "1.1.0",
"version": "1.1.1",
"description": "A NativeScript-Vue plugin for connecting to the standalone vue-devtools",
"main": "index.js",
"scripts": {
Expand All @@ -27,8 +27,8 @@
},
"homepage": "https://github.com/nativescript-vue/nativescript-vue-devtools#readme",
"peerDependencies": {
"nativescript-toast": "*",
"nativescript-socket.io": "*",
"nativescript-toasty": "*",
"nativescript-socketio": "*",
"tns-core-modules": "*",
"@vue/devtools": "*"
}
Expand Down