Vue-devtools: Environment agnostic backend

Created on 31 Jul 2018  路  1Comment  路  Source: vuejs/vue-devtools

Current version of devtools backend is built with assumption that application is running in browser environment. It assumes global variable window and attaches DOM elements and events to document.
This makes it difficult to use devtools in with NativeScript and other environments rendering Vue applications.

Problems:

  • Dependence on window (window is not defined)
  • JavaScript Socket.IO client does not work in native environment
  • Instance scan walks DOM nodes on document (document is not defined)
  • Toast and Highlight element are again HTML based (can not use document.createElement)
enhancement medium

Most helpful comment

As a quick hack I replaced window with global, toast with nativescript-toast, socket.io-client with nativescript-socket.io, dropped highlight element, removed instance scan (explicitly set rootInstances).

But we need to structure the backend API for a stable solution. I feel dependence on globals like window and global makes backend very brittle. May be we can move such dependencies in one place and have a concrete well defined backend API where things like showToast or highlightElement or SocketClient can be overridden.

/cc @yyx990803 @Akryum @michalsnik

>All comments

As a quick hack I replaced window with global, toast with nativescript-toast, socket.io-client with nativescript-socket.io, dropped highlight element, removed instance scan (explicitly set rootInstances).

But we need to structure the backend API for a stable solution. I feel dependence on globals like window and global makes backend very brittle. May be we can move such dependencies in one place and have a concrete well defined backend API where things like showToast or highlightElement or SocketClient can be overridden.

/cc @yyx990803 @Akryum @michalsnik

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Gedminas picture Gedminas  路  3Comments

yyx990803 picture yyx990803  路  3Comments

bajzarpa picture bajzarpa  路  3Comments

sithuaung picture sithuaung  路  4Comments

mitramejia picture mitramejia  路  3Comments