dymokomi/luce-browser-engine
Source of release 0.6.1
0.6.1 / src / web / web_idl / observable_array.lucb
#==============================================================================================
#
# observable_array - WebIDL::ObservableArray: a JS Array whose changes run IDL callbacks
#
# DESCRIPTION:
# Port of Libraries/LibWeb/WebIDL/ObservableArray.cpp (lines 1-78) and ObservableArray.h
# (lines 1-59). An ObservableArray is a JS::Array (phase 3); the set / delete callbacks and
# their edges are here.
#
# Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
# SPDX-License-Identifier: BSD-2-Clause
#
#==============================================================================================
## Ported from Libraries/LibWeb/WebIDL/ObservableArray.cpp:14 Web::WebIDL::ObservableArray::create:
## realm.create<ObservableArray>(realm, realm.intrinsics().array_prototype()).
pub func idl_observable_array_create(realm: Realm*) -> IdlObservableArray*:
trap("unported (P3): Web::WebIDL::ObservableArray::create (a JS::Array)")
## Ported from Libraries/LibWeb/WebIDL/ObservableArray.cpp:20 Web::WebIDL::ObservableArray::ObservableArray:
## JS::Array(realm, prototype), set_may_interfere_with_indexed_property_access().
pub func idl_observable_array_construct(this: IdlObservableArray*, realm: Realm*, prototype: JsObject*):
trap("unported (P3): Web::WebIDL::ObservableArray::ObservableArray (a JS::Array)")
## Ported from Libraries/LibWeb/WebIDL/ObservableArray.cpp:26 Web::WebIDL::ObservableArray::visit_edges (override).
pub func idl_observable_array_visit_edges_impl(base: gc.Cell*, visitor: gc.CellVisitor*):
let this = (IdlObservableArray*)base
gc.cell_visit_edges_impl(base, visitor)
gc.cell_visitor_visit_t(visitor, this.m_on_set_an_indexed_value)
gc.cell_visitor_visit_t(visitor, this.m_on_delete_an_indexed_value)
## Ported from Libraries/LibWeb/WebIDL/ObservableArray.cpp:33 Web::WebIDL::ObservableArray::set_on_set_an_indexed_value_callback.
pub func idl_observable_array_set_on_set_an_indexed_value_callback(this: IdlObservableArray*, callback: ak.Function1[JsValue*, unit]):
this.m_on_set_an_indexed_value = gc.create_function1[JsValue*, unit](gc.cell_heap(this.cell()), callback)
## Ported from Libraries/LibWeb/WebIDL/ObservableArray.cpp:38 Web::WebIDL::ObservableArray::set_on_delete_an_indexed_value_callback.
pub func idl_observable_array_set_on_delete_an_indexed_value_callback(this: IdlObservableArray*, callback: ak.Function1[JsValue, unit]):
this.m_on_delete_an_indexed_value = gc.create_function1[JsValue, unit](gc.cell_heap(this.cell()), callback)
## Ported from Libraries/LibWeb/WebIDL/ObservableArray.cpp:43 Web::WebIDL::ObservableArray::internal_set (virtual).
pub func idl_observable_array_internal_set_impl(this: IdlObservableArray*, property_key: JsPropertyKey, value: JsValue, receiver: JsValue, metadata: JsCacheableSetPropertyMetadata*?, phase: JsObjectPropertyLookupPhase) -> bool!:
trap("unported (P3): Web::WebIDL::ObservableArray::internal_set (the JS::Array's [[Set]])")
## Ported from Libraries/LibWeb/WebIDL/ObservableArray.cpp:50 Web::WebIDL::ObservableArray::internal_delete (virtual).
pub func idl_observable_array_internal_delete_impl(this: IdlObservableArray*, property_key: JsPropertyKey) -> bool!:
trap("unported (P3): Web::WebIDL::ObservableArray::internal_delete (the JS::Array's [[Delete]])")
## Ported from Libraries/LibWeb/WebIDL/ObservableArray.cpp:62 Web::WebIDL::ObservableArray::append.
pub func idl_observable_array_append(this: IdlObservableArray*, value: JsValue) -> !:
trap("unported (P3): Web::WebIDL::ObservableArray::append (the JS::Array's indexed storage)")
## Ported from Libraries/LibWeb/WebIDL/ObservableArray.cpp:70 Web::WebIDL::ObservableArray::clear.
pub func idl_observable_array_clear(this: IdlObservableArray*):
trap("unported (P3): Web::WebIDL::ObservableArray::clear (the JS::Array's indexed storage)")
## Ported from Libraries/LibWeb/WebIDL/ObservableArray.h:36 Web::WebIDL::ObservableArray::for_each:
## each element of the JS::Array, as T.
pub func idl_observable_array_for_each[T, TCallback](this: IdlObservableArray*, callback: TCallback):
trap("unported (P3): Web::WebIDL::ObservableArray::for_each (the JS::Array's indexed storage)")