X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/d2743081b16406a557258a8615905b360c59b96b..56f57e5b36301ac84c1ca5d4eb7fa363f79c81f6:/JavaScript.hpp diff --git a/JavaScript.hpp b/JavaScript.hpp index 38b2f60..a94dbb9 100644 --- a/JavaScript.hpp +++ b/JavaScript.hpp @@ -53,6 +53,7 @@ extern JSStringRef toCYON_s; extern JSStringRef toJSON_s; extern JSStringRef toPointer_s; extern JSStringRef toString_s; +extern JSStringRef weak_s; void CYInitializeDynamic(); JSGlobalContextRef CYGetJSContext(); @@ -82,6 +83,7 @@ void CYSetProperty(JSContextRef context, JSObjectRef object, JSStringRef name, J void CYSetPrototype(JSContextRef context, JSObjectRef object, JSValueRef prototype); +JSValueRef CYGetCachedValue(JSContextRef context, JSStringRef name); JSObjectRef CYGetCachedObject(JSContextRef context, JSStringRef name); JSValueRef CYCastJSValue(JSContextRef context, bool value); @@ -203,4 +205,13 @@ class CYJSString { } }; +typedef struct OpaqueJSWeakObjectMap *JSWeakObjectMapRef; +typedef void (*JSWeakMapDestroyedCallback)(JSWeakObjectMapRef map, void *data); + +extern "C" JSWeakObjectMapRef JSWeakObjectMapCreate(JSContextRef ctx, void *data, JSWeakMapDestroyedCallback destructor) __attribute__((__weak_import__)); +extern "C" void JSWeakObjectMapSet(JSContextRef ctx, JSWeakObjectMapRef map, void *key, JSObjectRef) __attribute__((__weak_import__)); +extern "C" JSObjectRef JSWeakObjectMapGet(JSContextRef ctx, JSWeakObjectMapRef map, void *key) __attribute__((__weak_import__)); +extern "C" bool JSWeakObjectMapClear(JSContextRef ctx, JSWeakObjectMapRef map, void *key, JSObjectRef object) __attribute__((__weak_import__)); +extern "C" void JSWeakObjectMapRemove(JSContextRef ctx, JSWeakObjectMapRef map, void* key) __attribute__((__weak_import__)); + #endif/*CYCRIPT_JAVASCRIPT_HPP*/