docs
Loading...
Searching...
No Matches
JavaScript.h
Go to the documentation of this file.
1///
2/// Copyright (C) 2026 Ultralight, Inc. All rights reserved.
3/// A license is required for commercial use. https://ultralig.ht
4///
5#pragma once
8#include <Ultralight/RefPtr.h>
9#include <Ultralight/String.h>
10
11// The typed JavaScript layer (ultralight::js) is opt-in: include <Ultralight/JS.h> (the
12// whole bridge) or individual <Ultralight/js/*.h> headers directly. The js/ headers carry
13// the ULJS C API type surface, so they are deliberately not included here.
14
15namespace ultralight {
16
17///
18/// This class wraps a JSContextRef (a JavaScript execution context for use with JavaScriptCore)
19/// and locks the context on the current thread for the duration of its lifetime.
20///
22public:
23 /// Get the underlying JSContextRef for use with JavaScriptCore C API
24 virtual JSContextRef ctx() = 0;
25
26 /// Typecast to a JSContextRef for use with JavaScriptCore C API
27 operator JSContextRef();
28
29protected:
30 virtual ~JSContext();
31};
32
33} // namespace ultralight
#define UExport
Definition Exports.h:22
const struct OpaqueJSContext * JSContextRef
Definition JSBase.h:43
This class wraps a JSContextRef (a JavaScript execution context for use with JavaScriptCore) and lock...
Definition JavaScript.h:21
virtual JSContextRef ctx()=0
Get the underlying JSContextRef for use with JavaScriptCore C API.
Interface for all ref-counted objects that will be managed using the RefPtr<> smart pointer.
Definition RefPtr.h:49
Root namespace for every public Ultralight type, function, and enumeration.