@evan.network/ui-angular-core
Version:
The angular-core operates as an global and central library for the evan.network Angular 5 frontend development. Using this project you will be able to to the following things:
247 lines (246 loc) • 9.3 kB
TypeScript
import { Router, ActivatedRoute, // '@angular/core';
Location, // '@angular/common
Observable, // 'rxjs/Observable'
TranslateService, // @ngx-translate/core
Platform } from 'angular-libs';
import { SingletonService } from '../singleton-service';
import { EvanUtilService } from '../utils';
/**************************************************************************************************/
/**
* Angular 5 routing wrapper service.
*
* @class Injectable EvanRoutingService
*/
export declare class EvanRoutingService {
router: Router;
activeRoute: ActivatedRoute;
location: Location;
private translate;
private singleton;
private utils;
private platform;
/**
* loaded navigate back status (Route.data.navigateBack)
*/
navigateBackStatus: any;
/**
* navigation subscriptions
*/
subscriptions: any;
/**
* function used to handle android back button navigation
*/
backButtonFunc: Function;
/**
* require dependencies & set routing subscriptions
*/
constructor(router: Router, activeRoute: ActivatedRoute, location: Location, translate: TranslateService, singleton: SingletonService, utils: EvanUtilService, platform: Platform);
/**
* Lookup the current route configuration or it's parent, to find an route
* where the path exists.
*
* @param {string} path Route path to find
* @param {any} parent A route configuration where the child should
* be searched.
* @return {string} The loaded route
*/
getRoute(path: string, parent?: any): any;
/**
* Takes an routeUrl, removes #, /#, #/ and returns the original hash value
* without query params
*
* @param {string} routeUrl RouteUrl like the following :
* #/dapp/dapp1?param1=est
* @return {string} transforms #/dapp/dapp1?param1=est to dapp/dapps
*/
getRouteFromUrl(routeUrl: string): string;
/**
* Watches the current router url and splits out the last hash param that
* represents the module id.
*
* @return {Observable<string>} an Observable that resolves url updates.
*/
activeRouteName(): Observable<string>;
/**
* Watches the current router url and splits out the last hash param that
* represents the module id.
*
* @return {Observable<string>} an Observable that resolves url updates.
*/
activeRootRouteName(): Observable<string>;
/**
* Returns the deepest activedRoute of the current parent activatedRoute. This
* one will be the active route. Used to consume route data.
*
* @param {ActivatedRoute} route The activatedRoute or one of it's
* children
* @param {number} deep Recursion deep, cancel after 20
* recursion to prevent dead lock
* @param {string} childPath Check for an additional childPath
* to return innerst active route
* @return {ActivatedRoute} deepest ActivatedRoute
*/
getActiveChild(route: ActivatedRoute, deep?: number, childPath?: string): ActivatedRoute;
/**
* Search for the current active route and set the current navigateBackStatus.
* This is used by "canNavigateBack" and "goBack" function to handle display
* of back button or to go to a specific route.
*/
setNavigateBackStatus(): void;
/**
* Returns the current root component.
*
* @return {any} this.activeRoute.firstChild
*/
getActiveRoot(): any;
/**
* Get the DApp name from an route
*
* @param {string} routePath route path to parse the dapp from
* @return {string} dappName
*/
getDAppNameFromRoutePath(routePath: string): string;
/**
* Get the DApp name from an route
*
* @return {string} dapp name from current route
*/
getDAppNameFromCurrRoutePath(): string;
/**
* Returns an Oberservable that updates triggers when a route was changed and
* returns if a back navigation should be available.
*
* @return {Observable<boolean>} True if able to navigate back, False otherwise.
*/
canNavigateBack(): Observable<boolean>;
/**
* Uses an hash value and replaces the current hash with the new one. But it will use href = to
* force parent dapp router handling, if we only set the hash, the navigation will stuck within
* the current child DApp.
*
* e.g. dashboard/favorites goes back to dashboard with empty history stack
* but nothing will happen because the favorites capured the navigation event and
* stops bubbling
*
* @param {string} hash new window.location.hash value
*/
forceUrlNavigation(hash: string): void;
/**
* Goes back. If this.navigateBackStatus contains an route string, navigate to
* this route else trigger location.back().
*/
goBack(): Promise<void>;
/**
* Navigates to the dappprofile relative to the active dashboard
*/
goToProfile(): void;
/**
* Navigates to the dapp queue relative to the active dashboard
*/
goToQueue(): void;
/**
* Navigates to the dapp mailbox relative to the active dashboard
*/
goToMails(): void;
/**
* Navigates to the dapp logging relative to the active dashboard
*/
goToLogging(): void;
/**
* Navigates to the dapp dashboard relative to the active dashboard
*/
goToDashboard(): void;
/**
* Use special "this.router.navigate" properties.
*
* @param {string} route route name to navigate to
* @param {boolean} relativeToRoot navigate relative to current parent
* route or use only the route string
* @param {any} queryParams query params that should be applied
* to the navigated
* routes(?param1=...¶m2=...)
*/
navigate(route: string, relativeToRoot?: boolean, queryParams?: any): void;
/**
* Open an ENS path
*
* @param {string} ensAddress ENS Address to open
* @param {string} relativeTo get the route with the specific name and
* use the ensAddress relative to the
* specified route
* @param {any} queryParams query params that should be applied to
* the navigated
* routes(?param1=...¶m2=...)
*/
openENS(ensAddress: string, relativeTo?: string, queryParams?: any): void;
/**
* Get a parameter value from the current active route.
*
* @param {string} param Parameter to get from the current route
* state.
* @return {any} data parameter value
*/
getDataParam(param: string): any;
/**
* Returns an parameter from the current route or it's children
*
* @param {any} param param key
* @return {any} hash parameter value
*/
getHashParam(param: string): any;
/**
* Return all query params as object.
*
* @return {any} deep copy of the current query params
*/
getQueryparams(): any;
/**
* Get a parameter value from the current active route.
*
* @param {string} param Parameter to get from the current route
* state.
* @return {any} data parameter value
*/
getRouteConfigParam(param: string): any;
/**
* Get a parameter value from the current root route.
*
* @param {string} param Parameter to get from the current route state.
* @return {any} The root route configuration parameter.
*/
getRootRouteConfigParam(param: string): any;
/**
* Triggers an loading of the current split pane content.
*/
reloadCurrentContent(): void;
/**
* window.location.reload();
*/
windowLocationReload(): void;
/**
* Register for an route change event.
*
* @param {Function} callback Function to call if an route change ends
* @return {Function} call to unscubscribe
*/
subscribeRouteChange(callback: any): Function;
/**
* Watching one time for a route change.
*
* @return {Observable} called on after the first route change
*/
onceNavigated(): Observable<void>;
/**
* Return the current active route ENS
* (https://.../dashboard.evan/dapp1.evan/dapp2.evan => dashboard.evan)
*
* @return {<type>} The active root ens.
*/
getActiveRootEns(): string;
/**
* return this.getHashParam('address') or Split the current url hash and return the latest path.
*
* @return {<type>} The stand alone contract identifier.
*/
getContractAddress(): string;
}