Stone.js API
    Preparing search index...

    Class representing an IncomingBrowserEvent.

    Mr. Stone evensstone@gmail.com

    Hierarchy

    • IncomingEvent
      • IncomingBrowserEvent
    Index

    The cookies included in the request.

    locale: string

    The locale of the event.

    metadata: Record<string, unknown>

    The metadata associated with the event.

    method: "GET"

    The HTTP method of the request.

    protocol: string

    The protocol used for the request (e.g., http or https).

    query: URLSearchParams

    The query parameters of the request.

    queryString?: string

    The query string of the request.

    routeResolver?: () => IRoute
    source: IncomingEventSource

    The source of the event.

    timeStamp: number

    The timestamp of the event creation.

    type: string

    The type of the event.

    url: URL

    The URL of the request.

    userResolver?: () => unknown
    INCOMING_BROWSER_EVENT: "stonejs@incoming_browser_event" = 'stonejs@incoming_browser_event'
    • get decodedPathname(): string

      Returns string

      The decoded pathname of the URL.

    • get hash(): string

      Returns string

      The hash part of the URL.

    • get host(): string

      Returns string

      The host of the URL (hostname:port).

    • get hostname(): string

      Returns string

      The hostname of the URL.

    • get isSecure(): boolean

      Returns boolean

      Whether the request was made over a secure connection.

    • get params(): Record<string, unknown>

      Returns Record<string, unknown>

      The route parameters.

    • get path(): string

      Returns string

      The full path including pathname and search query.

    • get pathname(): string

      Returns string

      The pathname of the URL.

    • get platform(): string | symbol

      Get the platform of the event source.

      Returns string | symbol

      The platform of the event source.

    • get scheme(): string

      Returns string

      The protocol of the URL (e.g., "http" or "https").

    • get segments(): string[]

      Returns string[]

      The URL segments split by '/'.

    • get uri(): string

      Returns string

      The full URL as a string.

    • get userAgent(): string

      Returns string

      The user agent, or undefined outside a browser (SSR/tests/workers).

    • Return a cloned instance.

      The metadata container is deep-copied (plain objects and arrays are recreated, special values kept by reference) so that mutating the clone's metadata — e.g. via middleware — never leaks back into the original event. This is what makes the Kernel's originalEvent snapshot a faithful pre-middleware copy.

      Returns this

      A cloned instance of the current class.

    • Generate a unique fingerprint for the event.

      Returns string

      The generated fingerprint as a base64 string.

    • Get data from the request.

      Priority:

      1. Route params
      2. Query params
      3. Cookies
      4. Metadata
      5. Fallback value

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to look for.

      Returns TReturn

      The value of the key or the fallback.

    • Get data from the request.

      Priority:

      1. Route params
      2. Query params
      3. Cookies
      4. Metadata
      5. Fallback value

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to look for.

      • fallback: TReturn

        A fallback value if the key is not found.

      Returns TReturn

      The value of the key or the fallback.

    • Get a cookie value.

      Type Parameters

      Parameters

      • name: string

        The cookie name.

      Returns TReturn

      The cookie value or the fallback.

    • Get a cookie value.

      Type Parameters

      Parameters

      • name: string

        The cookie name.

      • fallback: TReturn

        A fallback value if the cookie is not found.

      Returns TReturn

      The cookie value or the fallback.

    • Get data from metadata.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to retrieve from metadata.

      Returns TReturn

      The value associated with the key or the fallback.

    • Get data from metadata.

      Type Parameters

      • TReturn = unknown

      Parameters

      • key: string

        The key to retrieve from metadata.

      • fallback: TReturn

        The fallback value if the key is not found.

      Returns TReturn

      The value associated with the key or the fallback.

    • Retrieve a parameter from the route if it exists.

      Type Parameters

      • TReturn = unknown

      Parameters

      • name: string

        The name of the parameter to retrieve.

      Returns TReturn

      The value of the parameter if it exists, otherwise undefined.

    • Retrieve a parameter from the route if it exists.

      Type Parameters

      • TReturn = unknown

      Parameters

      • name: string

        The name of the parameter to retrieve.

      • fallback: TReturn

        The fallback value if the parameter does not exist.

      Returns TReturn

      The value of the parameter if it exists, otherwise undefined.

    • Get the route resolver function.

      Returns () => IRoute

      The route resolver function.

    • Get the URI with or without the domain.

      Parameters

      • withDomain: boolean = false

        Whether to include the domain in the URI.

      Returns string

      The URI with or without the domain.

    • Get the user instance.

      Type Parameters

      • T = undefined

      Returns T

      The user object, resolved through a user resolver function if available.

    • Get the user resolver function.

      Returns () => unknown

      The user resolver function.

    • Check if a cookie exists.

      Parameters

      • name: string

        The cookie name to check.

      Returns boolean

      True if the cookie exists, otherwise false.

    • Check if the given value is equal to the specified value.

      Parameters

      • key: string

        The key to check.

      • value: unknown

        The value to compare against.

      Returns boolean

      True if the key's value is equal to the specified value, false otherwise.

    • Check if the current event method matches the given method.

      Parameters

      • method: string

        The method to check.

      Returns boolean

      True if the event method matches, otherwise false.

    • Check if the event source is from a platform.

      Parameters

      • platform: string | symbol

        The platform to check.

      Returns boolean

      True if the event source is from the platform, false otherwise.

    • Add data to metadata.

      Parameters

      • key: string | Record<string, unknown>

        The key or object to add to metadata.

      • Optionalvalue: unknown

        The value to associate with the key.

      Returns this

      This Event instance.

    • Set the route resolver function.

      Type Parameters

      Parameters

      • resolver: () => RouteType

        The route resolver function.

      Returns this

      The current instance for method chaining.

    • Set the user resolver function.

      Parameters

      • resolver: () => unknown

        The user resolver function.

      Returns this

      The current instance for method chaining.

    • Generate a full URL for the given path.

      Parameters

      • path: string

        The path to append to the base URL.

      Returns string

      The full URL for the given path.

    INCOMING_EVENT: string

    INCOMING_EVENT Event name, fires on platform message.

    IncomingEvent#INCOMING_EVENT