mini-ioc-vue
Advanced tools
Comparing version 0.2.2 to 0.3.0
import Container, { AnyClass } from 'mini-ioc'; | ||
import { InjectionKey } from 'vue'; | ||
import { InjectionKey as Vue2InjectionKey } from '@vue/composition-api'; | ||
export declare const APP_IOC_CONTAINER_INJECT_KEY = "__VueAppDIContainer__"; | ||
export declare const injectKey: InjectionKey<Container> | Vue2InjectionKey<Container>; | ||
export declare const injectKey: unique symbol; | ||
export declare function provideContainer(container?: Container): { | ||
[x: string]: Container; | ||
[injectKey]: Container; | ||
}; | ||
export declare function injectContainer(): { | ||
__VueAppDIContainer__: symbol; | ||
export declare const injectMixin: { | ||
readonly inject: { | ||
readonly __VueAppDIContainer__: { | ||
readonly from: typeof injectKey; | ||
readonly default: null; | ||
}; | ||
}; | ||
}; | ||
export declare function computedResolver<T>(ctor: AnyClass<T>, newInstance?: boolean): () => T; |
16
index.js
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.computedResolver = exports.injectContainer = exports.provideContainer = exports.injectKey = exports.APP_IOC_CONTAINER_INJECT_KEY = void 0; | ||
exports.computedResolver = exports.injectMixin = exports.provideContainer = exports.injectKey = exports.APP_IOC_CONTAINER_INJECT_KEY = void 0; | ||
const mini_ioc_1 = require("mini-ioc"); | ||
@@ -13,8 +13,10 @@ exports.APP_IOC_CONTAINER_INJECT_KEY = '__VueAppDIContainer__'; | ||
exports.provideContainer = provideContainer; | ||
function injectContainer() { | ||
return { | ||
[exports.APP_IOC_CONTAINER_INJECT_KEY]: exports.injectKey, | ||
}; | ||
} | ||
exports.injectContainer = injectContainer; | ||
exports.injectMixin = { | ||
inject: { | ||
[exports.APP_IOC_CONTAINER_INJECT_KEY]: { | ||
from: exports.injectKey, | ||
default: null, | ||
}, | ||
}, | ||
}; | ||
function computedResolver(ctor, newInstance = false) { | ||
@@ -21,0 +23,0 @@ return function () { |
{ | ||
"name": "mini-ioc-vue", | ||
"version": "0.2.2", | ||
"version": "0.3.0", | ||
"description": "Vue.js mini-ioc binding internal package", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
45
2308