AngularTS
    Preparing search index...

    Class Scope

    Scope class for the Proxy. It intercepts operations like property access (get) and property setting (set), and adds support for deep change tracking and observer-like behavior.

    Index

    Constructors

    • Initializes the handler with the target object and a context.

      Parameters

      • Optionalcontext: Scope

        The context containing listeners.

      • Optionalparent: Scope

        Custom parent.

      Returns Scope

    Properties

    _children: Scope[]
    _destroyed: boolean
    _foreignListeners: Map<string, Listener[]>
    _foreignProxies: Set<Scope>
    _listeners: Map<string, ScopeEventListener[]>
    _objectListeners: WeakMap<object, string[]>
    _scheduled: Listener[]
    _watchers: Map<string, Listener[]>
    $handler: this
    $id: number
    $parent?: Scope
    $proxy: Scope
    $root: RootScopeService
    $scopename?: string
    $target: any
    propertyMap: Record<PropertyKey, any>

    Methods

    • Recursively schedules listeners for every reachable object key in the value.

      Parameters

      • value: ScopeTarget | undefined

      Returns void

    • Removes a listener by id from the foreign watcher map.

      Parameters

      • key: string
      • id: number

      Returns boolean

    • Removes a listener by id from the local watcher map.

      Parameters

      • key: string
      • id: number

      Returns boolean

    • Internal event propagation helper.

      Propagates either upward ($emit) or downward ($broadcast) and constructs the shared event object on first use.

      Parameters

      • __namedParameters: { broadcast: boolean; event?: ScopeEvent; name: string }
      • ...args: any[]

      Returns ScopeEvent | undefined

    • Returns whether this scope instance is the root scope.

      Returns boolean

    • Resolves the watched value and notifies a single listener.

      Parameters

      Returns void

    • Registers a listener under a watched key owned by a foreign proxied scope.

      Parameters

      Returns void

    • Registers a listener under a watched key on this scope.

      Parameters

      Returns void

    • Queues listener notification for the next microtask, optionally filtering the list first.

      Parameters

      Returns void

    • Evaluates an expression and routes any thrown error through the exception handler.

      Parameters

      • expr: string

      Returns any

    • Broadcasts an event downward through the scope hierarchy.

      Parameters

      • name: string
      • ...args: any[]

      Returns ScopeEvent | undefined

    • Returns void

    • Emits an event upward through the scope hierarchy.

      Parameters

      • name: string
      • ...args: any[]

      Returns ScopeEvent | undefined

    • Evaluates an Angular expression in the context of this scope.

      Parameters

      • expr: string
      • Optionallocals: Record<string, any>

      Returns any

    • Returns void

    • Searches this scope tree for a scope with the given id.

      Parameters

      • id: string | number

      Returns Scope | undefined

    • Merges enumerable properties from the provided object into the current scope target.

      Parameters

      • newTarget: object

      Returns void

    • Creates a prototypically inherited child scope.

      Parameters

      • OptionalchildInstance: Scope

      Returns Scope

    • Creates an isolate child scope that does not inherit watchable properties directly.

      Parameters

      • Optionalinstance: Scope

      Returns Scope

    • Registers an event listener on this scope and returns a deregistration function.

      Parameters

      • name: string
      • listener: ScopeEventListener

      Returns () => void

    • Queues a callback to run after the current listener batch completes.

      Parameters

      • fn: () => void

      Returns void

    • Searches the scope tree for a scope registered under the provided name.

      Parameters

      • name: string

      Returns Scope | undefined

    • Creates a transcluded child scope linked to this scope and an optional parent instance.

      Parameters

      • OptionalparentInstance: Scope

      Returns Scope

    • Registers a watcher for a property along with a listener function. The listener function is invoked when changes to that property are detected.

      Parameters

      • watchProp: string

        An expression to be watched in the context of this model.

      • OptionallistenerFn: ListenerFn

        A function to execute when changes are detected on watched context.

      • Optionallazy: boolean = false

        A flag to indicate if the listener should be invoked immediately. Defaults to false.

      Returns (() => void) | undefined

      A function to deregister the watcher, or undefined if no listener function is provided.

    • Parameters

      • target: ScopeTarget

        The target object.

      • property: string | number | symbol

        The name of the property being deleted.

      Returns boolean

    • Intercepts property access on the target object. It checks for specific properties (watch and sync) and binds their methods. For other properties, it returns the value directly.

      Parameters

      • target: ScopeTarget

        The target object.

      • property: string | number | symbol

        The name of the property being accessed.

      • proxy: Scope

        The proxy object being invoked.

      Returns any

      The value of the property or a method if accessing watch or sync.

    • Intercepts and handles property assignments on the target object. If a new value is an object, it will be recursively proxied.

      Parameters

      • target: ScopeTarget

        The target object.

      • property: string

        The name of the property being set.

      • value: any

        The new value being assigned to the property.

      • proxy: Scope

        The proxy intercepting property access.

      Returns boolean

      Returns true to indicate success of the operation.