Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-browser-engine

Source of release 0.6.0

0.6.0 / src / web / html / pop_state_event.lucb

#==============================================================================================
#
#   pop_state_event - HTML::PopStateEvent, fired at a window when a same-document history
#   step is applied
#
#   DESCRIPTION:
#       Port of Libraries/LibWeb/HTML/PopStateEvent.cpp (lines 1-45) and the accessor of
#       PopStateEvent.h.
#
#       Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
#       Copyright (c) 2026 the luce-browser authors.
#       SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================

## Ported from PopStateEvent.cpp:17 Web::HTML::PopStateEvent::create.
pub func html_pop_state_event_create(realm: Realm*, event_name: ak.FlyString, event_init: HtmlPopStateEventInit) -> HtmlPopStateEvent*:
    return realm_create_html_pop_state_event(realm, realm, event_name, event_init)

## Ported from PopStateEvent.cpp:22 Web::HTML::PopStateEvent::construct_impl.
pub func html_pop_state_event_construct_impl(realm: Realm*, event_name: ak.FlyString, event_init: HtmlPopStateEventInit) -> HtmlPopStateEvent*:
    return realm_create_html_pop_state_event(realm, realm, event_name, event_init)

## Ported from PopStateEvent.cpp:27 Web::HTML::PopStateEvent::PopStateEvent.
pub func html_pop_state_event_construct(this: HtmlPopStateEvent*, realm: Realm*, event_name: ak.FlyString, event_init: HtmlPopStateEventInit):
    dom_event_construct_dom_event_init(this.dom_event(), realm, event_name, event_init.event_init)
    this.m_state = event_init.state

## Ported from PopStateEvent.cpp:33 Web::HTML::PopStateEvent::initialize (override).
pub func html_pop_state_event_initialize_impl(base: JsCell*, realm: Realm*):
    web_set_prototype_for_interface(base, realm, BindInterfaceName.pop_state_event)
    dom_event_initialize_impl(base, realm)

## Ported from PopStateEvent.cpp:39 Web::HTML::PopStateEvent::visit_edges (override).
pub func html_pop_state_event_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
    let this = (HtmlPopStateEvent*)base
    dom_event_visit_edges_impl(base, visitor)
    js_visit_value(visitor, this.m_state)

## Ported from PopStateEvent.h:25 Web::HTML::PopStateEvent::state.
pub func html_pop_state_event_state(this: HtmlPopStateEvent*) -> JsValue:
    return this.m_state