diff --git a/core/interop/src/lib.rs b/core/interop/src/lib.rs index 9196a27602c..2813e9d0469 100644 --- a/core/interop/src/lib.rs +++ b/core/interop/src/lib.rs @@ -390,6 +390,18 @@ impl JsClass { } } +impl JsClass { + /// Clones the inner class instance. + /// + /// # Panics + /// + /// Panics if the inner object is currently borrowed mutably. + #[must_use] + pub fn clone_inner(&self) -> T { + self.inner.borrow().data().clone() + } +} + impl<'a, T: NativeObject + 'static> TryFromJsArgument<'a> for JsClass { fn try_from_js_argument( this: &'a JsValue,