Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/router / dist / OneRouterToRuleThemAll.d.ts
Size: Mime:
import { OneRouterSubscriberOnChange, OneRouterOptions, Location, HistoryType, RouterType, ObjWithValuesSerialized, OneUrl, UpdateTo, ParsedSearchParams, OneRouterEntriesType, TapEntriesType } from './typings';
/**
 * @todo subscribe, observe, unsubscribe
 *
 * @note modules/ does not hot reload
 * extends Container
 */
declare class OneRouterToRuleThemAll<EntriesType extends OneRouterEntriesType = OneRouterEntriesType> {
    oneUrl: OneUrl | undefined;
    store: Map<string, any>;
    shallowStore: Map<string, any>;
    _router: RouterType;
    /**
     * @deprecated
     */
    props: any;
    /**
     * @deprecated remove this
     * .shallow
     */
    observable: {
        urlList: any[];
        url: string;
    };
    setAsDirty(isDirty?: boolean): this;
    readonly url: any;
    router: RouterType<any>;
    handleRouteChange: (location: Location, action: string) => void;
    /**
     * @todo could ensure no duplication?
     */
    setUrl(value: string): this;
    readonly prevUrl: any;
    setTapEntries(tapEntries?: TapEntriesType): this;
    readonly location: Location;
    get(key: string): any;
    set(key: string, value: any): this;
    from(obj: any): this;
    urlFromExpress: OneUrl;
    /**
     * @todo optimize with computed
     */
    toString(): string;
    /**
     * @todo can use this for debug
     *       replacing using `pretty: true` in toString
     * @todo can serialize ALL like the `store` etc
     */
    toJSON(): {
        entries: EntriesType;
    };
    /**
     * @note the type was `AnyObj | string`
     *       but not sure how that makes much sense
     *       don't see the use case, YAGNI
     */
    has(data: string): boolean;
    /**
     * @see history/goBack
     * @description common naming
     * @alias goBack
     * @alias gotoBack
     */
    gotoPrev(): void;
    gotoNext(): void;
    /**
     * @example https://uxui.com/route?search=eh#hash
     * @alias fullyQualifiedWebAddress
     * @alias absolute
     * @alias absoluteWebAddress
     */
    readonly full: string;
    /**
     * @note also available in entries
     *       and the history.location can be from express
     */
    readonly origin: string;
    /**
     * @description (pathname.match(/\w+/gim) || []).join('')
     */
    readonly pathname: string;
    /**
     * @example
     *    localhost/eh/10/
     *    /eh/:categoryId
     *    match.params.categoryId
     *    => 10
     */
    private readonly matched;
    /**
     * @todo not sure if it's used
     */
    readonly searchParams: string | ParsedSearchParams;
    /**
     * @description this.router this.router.history history
     */
    readonly history: HistoryType;
    /**
     * @see http://unixpapa.com/js/querystring.html
     * @api https://github.com/sindresorhus/query-string#nesting
     * @todo these entries could be observable...
     */
    getSearchParams<ReturnType = ParsedSearchParams>(fallback?: string | any): ParsedSearchParams | ReturnType;
    /**
     * @todo should add parsing options
     * @param parsed object with values that can be parsed
     * @return destringified/parsed
     */
    parse(parsed: ObjWithValuesSerialized): ObjWithValuesSerialized;
    /**
     * @todo !!! optimize with a hash for sure
     *
     * @todo computed
     * @todo this needs to get the routing from routing
     * ^ need to put in config
     *
     * @alias toObj
     */
    entries(): EntriesType;
    /**
     * @tutorial https://github.com/ReactTraining/history/blob/master/modules/LocationUtils.js
     * @alias push
     * @alias merge
     * @alias updateQueryParams
     *
     * @fires observable update
     * @description any kind of url update can be done here
     *
     * @param to
     *
     * @example
     *   [state, pathname, hash]
     *   toUrlOrPathNameOrParams, optionalParamAsDataOrPath
     *   let to = toUrlOrPathNameOrParams
     *   let state = optionalParamAsDataOrPath
     *   let hash
     *   if (arguments.length === 2)
     */
    update(to: UpdateTo, options?: OneRouterOptions): any;
    /**
     * @param param query param to delete
     */
    delete(param: string): this;
    /**
     * @alias goto
     * @description same as update, but goto this url instead of merging
     */
    replace(path: string): this;
    /**
     * @description reset url, goto root
     */
    clearHistory(): this;
    clear(): this;
    /**
     * @alias observe
     * @alias subscribe
     * @param subscriber called when observable changes
     */
    onChange(subscriber: OneRouterSubscriberOnChange): this;
    /**
     * @description window.location.reload()
     */
    reload(): void;
    /**
     * @todo use chain-able/matcher
     *    ^ regexp, function, or string, or string wildcard/route-params
     *    @example isMatch(restrictedRoutes, this.pathname)
     */
    readonly isRestricted: boolean;
}
export { OneRouterToRuleThemAll };
export default OneRouterToRuleThemAll;