mz-dynamic-join
v0.0.8
Published
For dynamic add jss and css
Downloads
2
Readme
Описание
Позволяет динамически добавлять и безопасно очишать коды
Установка
npm i --save mz-mock-decorator
Примеры использования
import {MzMock, MzMockObservable, MzMockPromise, MzMockResultTypeEnum, MzMockSimple} from "./@res/mz-dynamic-join";
import {of} from "rxjs";
class Class {
@MzMockSimple (
{
result: 'from simple mock',
active: true
}
)
private simple (a: any, b: any) {
return `from result - a = ${a} | b = ${b}`;
}
@MzMockObservable (
{
result: 'from observable mock',
active: true
}
)
private mockSampleObservable (a: any, b: any) {
return of(`from result - a = ${a} | b = ${b}`)
}
@MzMockPromise (
{
result: 'from promise mock',
active: false
}
)
private mockSamplePromise1 (a: any, b: any) {
return new Promise(
(resolve) => {
resolve(`from promise - a = ${a} | b = ${b}`)
}
)
}
@MzMock (
{
result: 'from promise MzMock',
active: true,
type: MzMockResultTypeEnum.promise
}
)
private mockSamplePromise (a: any, b: any) {
return new Promise(
(resolve) => {
resolve(`from MzMock promise - a = ${a} | b = ${b}`)
}
)
}
@MzMock (
{
result: (a, b) => `from function MzMock- a = ${a} | b = ${b}`,
active: false,
type: MzMockResultTypeEnum.function
}
)
private mockSampleSimple2 (a: any, b: any) {
return `from function - a = ${a} | b = ${b}`;
}
/*
* return mock
* */
@MzMock(
{
type: MzMockResultTypeEnum.simple,
path: 'mock.test.a',
result: {mock: {test: { a: 1}}},
default: 0,
active: true
}
)
private testFunction ()
{
return 'from real 1';
}
}