Skip to content

Commit

Permalink
Moved decorators option interfaces to importable files
Browse files Browse the repository at this point in the history
  • Loading branch information
mmirecki-pgs-soft committed Jan 13, 2019
1 parent aee2924 commit f63ce69
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 31 deletions.
File renamed without changes.
18 changes: 2 additions & 16 deletions projects/ngx-store-decorators/src/lib/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { isObservable, Observable, OperatorFunction, Subscription } from 'rxjs';
import { select, Selector, Store } from '@ngrx/store';
import { takeUntil } from 'rxjs/operators';

import { IDecoratorOptionsForGet } from './decorators/injectables-decorators';

/*
* Const
* */
Expand All @@ -21,10 +23,6 @@ export const ERROR_MESSAGE_READONLY = (key: string) => `The "${key}" property is
* Interfaces
* */

export interface IDecoratorOptionsForGet {
args?: any[];
}

export interface IDecoratorOptionsForObservable {
log?: boolean;
pipe?: Array<OperatorFunction<any, any>>;
Expand All @@ -35,18 +33,6 @@ export interface IDecoratorOptionsForSubscription extends IDecoratorOptionsForOb
takeUntil?: string;
}

/* tslint:disable-next-line:no-empty-interface */
export interface IDecoratorOptionsSelect extends IDecoratorOptionsForGet, IDecoratorOptionsForObservable {}

/* tslint:disable-next-line:no-empty-interface */
export interface IDecoratorOptionsForSubscribe extends IDecoratorOptionsForGet, IDecoratorOptionsForSubscription {}

/* tslint:disable-next-line:no-empty-interface */
export interface IDecoratorOptionsForStoreSelect extends IDecoratorOptionsForObservable {}

/* tslint:disable-next-line:no-empty-interface */
export interface IDecoratorOptionsForStoreSubscribe extends IDecoratorOptionsForSubscription {}

/*
* Definitions
* */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@ import { Observable } from 'rxjs';

import * as fromCommon from '../common';

/*
* Interfaces
* */

export interface IDecoratorOptionsForGet {
args?: any[];
}

/* tslint:disable-next-line:no-empty-interface */
export interface IDecoratorOptionsSelect extends IDecoratorOptionsForGet, fromCommon.IDecoratorOptionsForObservable {}

/* tslint:disable-next-line:no-empty-interface */
export interface IDecoratorOptionsForSubscribe extends IDecoratorOptionsForGet, fromCommon.IDecoratorOptionsForSubscription {}

/**
* The decorator who pass Observable from injection method or property to decorated property
*
Expand All @@ -16,7 +30,7 @@ import * as fromCommon from '../common';
* public currency$: Observable<CurrencyInterface>;
* ```
*/
export function Select(injection: string, methodOrProperty: string, options?: fromCommon.IDecoratorOptionsSelect) {
export function Select(injection: string, methodOrProperty: string, options?: IDecoratorOptionsSelect) {
return function(target, key) {
const getter = function() {
const privateKeyName = '_' + key;
Expand Down Expand Up @@ -71,11 +85,7 @@ export function Select(injection: string, methodOrProperty: string, options?: fr
* public currency: CurrencyInterface;
* ```
*/
export function Subscribe(
injection: string,
methodOrProperty: string,
options?: fromCommon.IDecoratorOptionsForSubscribe
) {
export function Subscribe(injection: string, methodOrProperty: string, options?: IDecoratorOptionsForSubscribe) {
return function(target, key) {
const getter = function() {
const privateKeyName = '_' + key;
Expand Down Expand Up @@ -131,7 +141,7 @@ export function Subscribe(
* public currency: CurrencyInterface;
* ```
*/
export function Get(injection: string, methodOrProperty: string, options?: fromCommon.IDecoratorOptionsForGet) {
export function Get(injection: string, methodOrProperty: string, options?: IDecoratorOptionsForGet) {
return function(target, key) {
const getter = function() {
const privateKeyName = '_' + key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ import { Selector } from '@ngrx/store';

import * as fromCommon from '../common';

/*
* Interfaces
* */

/* tslint:disable-next-line:no-empty-interface */
export interface IDecoratorOptionsForStoreSelect extends fromCommon.IDecoratorOptionsForObservable {}

/* tslint:disable-next-line:no-empty-interface */
export interface IDecoratorOptionsForStoreSubscribe extends fromCommon.IDecoratorOptionsForSubscription {}

/**
* The decorator who pass Observable from injection method or property to decorated property
*
Expand All @@ -15,10 +25,7 @@ import * as fromCommon from '../common';
* public currency$: Observable<CurrencyInterface>;
* ```
*/
export function StoreSelect(
selector: Selector<any, any> | any,
options?: fromCommon.IDecoratorOptionsForStoreSelect
) {
export function StoreSelect(selector: Selector<any, any> | any, options?: IDecoratorOptionsForStoreSelect) {
return function(target, key) {
const getter = function() {
const privateKeyName = '_' + key;
Expand Down Expand Up @@ -70,10 +77,7 @@ export function StoreSelect(
* public currency: CurrencyInterface;
* ```
*/
export function StoreSubscribe(
selector: Selector<any, any>,
options?: fromCommon.IDecoratorOptionsForStoreSubscribe
) {
export function StoreSubscribe(selector: Selector<any, any>, options?: IDecoratorOptionsForStoreSubscribe) {
return function(target, key) {
const getter = function() {
const privateKeyName = '_' + key;
Expand Down

0 comments on commit f63ce69

Please sign in to comment.