letproxyHandler= jsCtx.object()try proxyHandler.set("get", convertible:JXValue(newFunctionIn: jsCtx, callback: cacheGet))try proxyHandler.set("set", convertible:JXValue(newFunctionIn: jsCtx, callback: cacheSet))try jsCtx.global.setProperty("_cacheProxyHandler", proxyHandler)try jsCtx.global.setProperty("_cache", jsCtx.object())// This actually doesn't do anything. We just need a backing object for the proxy.try jsCtx.eval(#""" var cache = new Proxy(_cache, _cacheProxyHandler); """#)privatefunc cacheGet(context:JXContext, object _:JXValue?, args:[JXValue])throws->JXValue{letkey=tryargs[1].stringValue
// ... Get and return the JXValue}privatefunc cacheSet(context:JXContext, object _:JXValue?, args:[JXValue])throws->JXValue{letkey=tryargs[1].stringValue
letvalue=args[2]// ... extract and store the value.}
It's a lot smaller than I had last night because I realised I could move the functions for getting and setting my cache directly to the proxy handler. Last night they were still on the cache object and I was using javascript to call them. So this is looking pretty good. The only real question I guess now is - is it possible to create the Proxy without requiring that single line of javascript?
Hi team, I'm trying to use JXKit in a project and running into issues because I have a limited understanding of how everything work together in the library.
I see the documentation has been out of action for at least a few months, and there don't appear to be any cached copies online, can this be resurrected, or is there any other documentation other than the code comments?