History

working to clean up the QtScript implementation and move towards completion of the proxy interface

Heather Anderson committed 5 years ago

Commit 2dd9d781 parent 1e018db38 files · +2240 −923Browse files

Showing the changes to libraries/script-engine/src/Scriptable.cpp (1 of 38 files). Show all

Unified · Split

libraries/script-engine/src/Scriptable.cpp+24−0
@@ -0,0 +1,24 @@
1+//
2+// Scriptable.cpp
3+// libraries/script-engine/src
4+//
5+// Created by Heather Anderson on 5/22/21.
6+// Copyright 2021 Vircadia contributors.
7+//
8+// Distributed under the Apache License, Version 2.0.
9+// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
10+//
11+
12+#include "Scriptable.h"
13+
14+#include <QtCore/QThreadStorage>
15+
16+static QThreadStorage<ScriptContext*> ScriptContextStore;
17+
18+ScriptContext* Scriptable::context() {
19+ return ScriptContextStore.localData();
20+}
21+
22+void Scriptable::setContext(ScriptContext* context) {
23+ ScriptContextStore.setLocalData(context);
24+}