@ui-tars/sdk
Version:
A powerful cross-platform(ANY device/platform) toolkit for building GUI automation agents for UI-TARS
29 lines (28 loc) • 985 B
JavaScript
/**
* Copyright (c) 2025 Bytedance, Inc. and its affiliates.
* SPDX-License-Identifier: Apache-2.0
*/
import { DEFAULT_CONTEXT } from "../constants.mjs";
var __webpack_require__ = {};
(()=>{
__webpack_require__.g = (()=>{
if ('object' == typeof globalThis) return globalThis;
try {
return this || new Function('return this')();
} catch (e) {
if ('object' == typeof window) return window;
}
})();
})();
const isBrowser = 'undefined' != typeof window && void 0 !== window.document;
const _globalThis = isBrowser ? window : __webpack_require__.g;
const GLOBAL_CONTEXT_KEY = Symbol.for('@ui-tars/sdk/context');
if (!_globalThis[GLOBAL_CONTEXT_KEY]) _globalThis[GLOBAL_CONTEXT_KEY] = DEFAULT_CONTEXT;
function setContext(context) {
_globalThis[GLOBAL_CONTEXT_KEY] = context;
}
function useContext() {
return _globalThis[GLOBAL_CONTEXT_KEY];
}
export { setContext, useContext };
//# sourceMappingURL=useContext.mjs.map