File

projects/netgrif-components-core/src/lib/registry/front-action-registry.service.ts

Index

Properties
Methods
Accessors

Constructor

constructor()

Methods

Public contains
contains(key: string)
Parameters :
Name Type Optional
key string No
Returns : boolean
Public get
get(key: string)
Parameters :
Name Type Optional
key string No
Public register
register(key: string, fn: FrontActionDefinition)
Parameters :
Name Type Optional
key string No
fn FrontActionDefinition No
Returns : void

Properties

Protected _registry
Type : Map<string | FrontActionDefinition>

Accessors

registry
getregistry()
setregistry(value: Map)
Parameters :
Name Type Optional
value Map<string | FrontActionDefinition> No
Returns : void
import {Injectable} from '@angular/core';
import {FrontActionDefinition} from "../actions/model/front-action-definition";

@Injectable({
    providedIn: 'root'
})
export class FrontActionRegistryService {

    protected _registry: Map<string, FrontActionDefinition>;

    constructor() {
        this._registry = new Map<string, FrontActionDefinition>();
    }

    get registry(): Map<string, FrontActionDefinition> {
        return this._registry;
    }

    set registry(value: Map<string, FrontActionDefinition>) {
        this._registry = value;
    }

    public register(key: string, fn: FrontActionDefinition): void {
        this._registry.set(key, fn);
    }

    public contains(key: string): boolean {
        return this._registry.has(key);
    }

    public get(key: string): FrontActionDefinition {
        if (this._registry.has(key)) {
            return this._registry.get(key);
        }
        return undefined;
    }
}

result-matching ""

    No results matching ""