Home Manual Reference Source Repository

Function

Static Public Summary
public

Inject(token: *): ParameterDecorator

Marks a param to be injected with the registered provider registered with the token.

public

Injectable(config: InjectableConfigArgs): ClassDecorator

Marks a dependency as injectable.

public

Lazy(): ParameterDecorator

Marks a dependency as lazy.

public

MemoizeFrom(properties: ...string[]): MethodDecorator

A decorator that memoizes a functions computation based on the current and previous value of other parameters.

public

ObserveViewHook(hook: string): PropertyDecorator

Creates an Observable that emits when the provided hook is invoked.

public

Optional(): ParameterDecorator

Marks a dependency as optional.

public

Self(): ParameterDecorator

Will only check the injector creating the dependency.

public

ViewComponent(config: ViewComponentConfigArgs): ClassDecorator

Registers view metadata with a component class.

public

ViewInsert(config: ViewInsertConfigArgs): PropertyDecorator

Sets up a view insert method.

public

ViewLinkInit(injections: ...any[]): MethodDecorator

Sets up an init method that is invoked at the time a view is linked by the ViewLinker.

public

ViewQuery(config: ViewQueryConfigArgs): MethodDecorator

Sets up a view query with the decorated method as the callback to receive the query results.

public

ViewResolve(config: ViewResolveConfigArgs): PropertyDecorator

Sets up a view resolve method.

public

clamp(val: *, min: *, max: *): *

public

defaults(dest: *, src: *): *

public

eq(value: *): *

public

A factory that creates a ForwardRef.

public

get(obj: *, path: *, defaultValue: *, comparer: *): *

public

getDefaultMetadata(): {"queries": *, "inits": *, "inserts": *, "resolves": *}

public

isBoolean(val: *): *

public

isFunction(val: *): *

public

isNumber(val: *): *

public

isObject(val: *): *

public

isObserver(val: *): *

public

isPromise(value: *): *

public

isString(val: *): *

public

isUndefined(val: *): *

public

negate(fn: *): *

public

partition(list: *, predicate: *): undefined[]

public

propEq(prop: *, value: *): *

public

round(val: *, precision: number): *

Static Public

public Inject(token: *): ParameterDecorator source

import {Inject} from 'ug-layout/di/decorators'

Marks a param to be injected with the registered provider registered with the token.

Params:

NameTypeAttributeDescription
token *

Return:

ParameterDecorator

public Injectable(config: InjectableConfigArgs): ClassDecorator source

import {Injectable} from 'ug-layout/di/decorators'

Marks a dependency as injectable. When the dependency is created using Injector.fromInjectable the dependency can define some scoped dependencies.

Params:

NameTypeAttributeDescription
config InjectableConfigArgs
  • optional
  • default: {}

Return:

ClassDecorator

Example:

@Injectabled({
  providers: [
    { provide: MyToken, useValue: 'blorg' }
  ]
})
class MyClass {
  constructor(
    @Inject(MyToken) private myBlorg: string
  ) {
    console.log(myBlorg); // => 'blorg
  }
}

Injector.fromInjectable(MyClass).get(MyToken) // => 'blorg';

public Lazy(): ParameterDecorator source

import {Lazy} from 'ug-layout/di/decorators'

Marks a dependency as lazy. Injects a function that will resolve the dependency.

Return:

ParameterDecorator

Example:

class MyClass {
  constructor(
    @Inject(MyToken) @Lazy() private getMyService: () => MyService
  ) {
    console.log(getMyService()); // => myService
  }
}

public MemoizeFrom(properties: ...string[]): MethodDecorator source

import {MemoizeFrom} from 'ug-layout/dom/decorators'

A decorator that memoizes a functions computation based on the current and previous value of other parameters.

Params:

NameTypeAttributeDescription
properties ...string[]

Return:

MethodDecorator

public ObserveViewHook(hook: string): PropertyDecorator source

import {ObserveViewHook} from 'ug-layout/view/hooks/decorators'

Creates an Observable that emits when the provided hook is invoked. The value emitted is the argument given to the hook. The hook completes when the view container is destroyed.

Params:

NameTypeAttributeDescription
hook string

The name of the hook. If an invalid hook name is given no value is emitted.

Return:

PropertyDecorator

public Optional(): ParameterDecorator source

import {Optional} from 'ug-layout/di/decorators'

Marks a dependency as optional. Returns null if not found.

Return:

ParameterDecorator

public Self(): ParameterDecorator source

import {Self} from 'ug-layout/di/decorators'

Will only check the injector creating the dependency. It will not check any parents.

Return:

ParameterDecorator

public ViewComponent(config: ViewComponentConfigArgs): ClassDecorator source

import {ViewComponent} from 'ug-layout/view/decorators'

Registers view metadata with a component class.

Params:

NameTypeAttributeDescription
config ViewComponentConfigArgs
  • optional
  • default: {}

Return:

ClassDecorator

public ViewInsert(config: ViewInsertConfigArgs): PropertyDecorator source

import {ViewInsert} from 'ug-layout/view/decorators'

Sets up a view insert method.

Params:

NameTypeAttributeDescription
config ViewInsertConfigArgs

Return:

PropertyDecorator

See:

public ViewLinkInit(injections: ...any[]): MethodDecorator source

import {ViewLinkInit} from 'ug-layout/view/decorators'

Sets up an init method that is invoked at the time a view is linked by the ViewLinker. Any dependencies need from the Layouts DI can be injected.

Params:

NameTypeAttributeDescription
injections ...any[]

Injection tokens for services needing to be injected into the controller.

Return:

MethodDecorator

public ViewQuery(config: ViewQueryConfigArgs): MethodDecorator source

import {ViewQuery} from 'ug-layout/view/decorators'

Sets up a view query with the decorated method as the callback to receive the query results.

Params:

NameTypeAttributeDescription
config ViewQueryConfigArgs
  • optional
  • default: {}

Return:

MethodDecorator

public ViewResolve(config: ViewResolveConfigArgs): PropertyDecorator source

import {ViewResolve} from 'ug-layout/view/decorators'

Sets up a view resolve method.

Params:

NameTypeAttributeDescription
config ViewResolveConfigArgs

Return:

PropertyDecorator

See:

public clamp(val: *, min: *, max: *): * source

import {clamp} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
val *
min *
max *

Return:

*

public defaults(dest: *, src: *): * source

import {defaults} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
dest *
src *

Return:

*

public eq(value: *): * source

import {eq} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
value *

Return:

*

public forwardRef(fn: Function): ForwardRef source

import {forwardRef} from 'ug-layout/di/Injector'

A factory that creates a ForwardRef.

Params:

NameTypeAttributeDescription
fn Function

Return:

ForwardRef

Example:

const test = forwardRef(() => 'test');

test.ref; // => 'test'

public get(obj: *, path: *, defaultValue: *, comparer: *): * source

import {get} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
obj *
path *
defaultValue *
comparer *
  • optional
  • default: isUndefined

Return:

*

public getDefaultMetadata(): {"queries": *, "inits": *, "inserts": *, "resolves": *} source

import {getDefaultMetadata} from 'ug-layout/view/decorators'

Return:

{"queries": *, "inits": *, "inserts": *, "resolves": *}

public isBoolean(val: *): * source

import {isBoolean} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
val *

Return:

*

public isFunction(val: *): * source

import {isFunction} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
val *

Return:

*

public isNumber(val: *): * source

import {isNumber} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
val *

Return:

*

public isObject(val: *): * source

import {isObject} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
val *

Return:

*

public isObserver(val: *): * source

import {isObserver} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
val *

Return:

*

public isPromise(value: *): * source

import {isPromise} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
value *

Return:

*

public isString(val: *): * source

import {isString} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
val *

Return:

*

public isUndefined(val: *): * source

import {isUndefined} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
val *

Return:

*

public negate(fn: *): * source

import {negate} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
fn *

Return:

*

public partition(list: *, predicate: *): undefined[] source

import {partition} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
list *
predicate *

Return:

undefined[]

public propEq(prop: *, value: *): * source

import {propEq} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
prop *
value *

Return:

*

public round(val: *, precision: number): * source

import {round} from 'ug-layout/utils/index'

Params:

NameTypeAttributeDescription
val *
precision number
  • optional
  • default: 0

Return:

*