Giter Club home page Giter Club logo

vife's Introduction

Vife - Vue Inspector Force Enabler

⚙ A simple util to swiftly enable Vue inspector in non-developing environment, 1.02kb gzipped+minified!

Vife (pronunced as /vif/) is a simple util for VueInspector which aims to provide a smoother develop experience at non-developing (aka. production, testing) environment.It enables VueInspector OnNeeded in runtime to avoid bringing performance overhead while you're not debugging.

Usage

Install via your package manager

# Using Yarn
yarn add vife
# Using NPM
npm install vife

Setup and export vife in your code

// import
import { createForceEnabler } from 'vife'
// create your enabler and export it to window or somewhere, simple usage
window.__vife__ = createForceEnabler(
  '#your-root-vue-el-selector'
)

// full usage
import { setup } from 'vife'
setup({ isVerbose: false }) // remove runtime logs
// authorize method to prevent illegal callups
const authorize = async () => {
  const authorized = await axios.get('somewhere/your/user/api')
  if (authorized) return true
  return false
}
window.__vife__ = createForceEnabler(
  '#your-root-vue-el-selector',
  '#root-mfe-portal-container-selector', // no need if not mfe
  { authorize } // custom authorize method
)

Use at your non-developping env by calling your custom enabler

__vife__()

API Documentation

createForceEnabler

/**
 * An util to provide a certain enabler for VueInspector
 * @param {string} [domElementOrSelector='#app'] Vue bindings' DOM element or selector
 * @param {string} [microFrontendRootSelector=''] Micro Frontend's root Element or Selector
 * @param {EnablerOptions} configOptions Configurations
 * @returns {AsyncFunction} enabler
 */
const createForceEnabler: (
  domElementOrSelector?: string,
  microFrontendRootSelector?: string,
  configOptions?: EnablerOptions
) => () => Promise<false | void | NodeJS.Timeout>;

vife's People

Contributors

a20185 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.