Skip to content

Commit

Permalink
feat: update source to be a installable component
Browse files Browse the repository at this point in the history
  • Loading branch information
vinayakkulkarni committed Aug 19, 2021
1 parent 03ca6ad commit 0633501
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/VSvg.vue → src/components/VSvg.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@

<script lang="ts">
import { computed, defineComponent, PropType } from 'vue';
import { Marker } from '../types';
import { Marker } from '~/types';
export default defineComponent({
name: 'VSvg',
name: 'Marker',
props: {
marker: {
type: Object as PropType<Marker>,
Expand Down
1 change: 1 addition & 0 deletions src/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default as VSvg } from './VSvg.vue';
3 changes: 0 additions & 3 deletions src/index.js

This file was deleted.

2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { VSvg } from './components';
export { default } from './install';
17 changes: 17 additions & 0 deletions src/install.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { App as Application, Plugin } from 'vue';
import { VSvg } from './components';
import { setVueInstance } from './utils/config/index';

let installed: boolean = false;

const install: Exclude<Plugin['install'], undefined> = (
instance: Application,
) => {
if (!installed) {
setVueInstance(instance);
instance.component('VSvg', VSvg);
installed = true;
}
};

export default install;
11 changes: 11 additions & 0 deletions src/utils/config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { App as Application } from 'vue';

const config = {};

export let VueInstance: Application;

export { config as default };

export const setVueInstance = (instance: Application) => {
VueInstance = instance;
};

0 comments on commit 0633501

Please sign in to comment.