Giter Club home page Giter Club logo

jxkit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jxkit's Issues

Proxy objects

Hi Marc, sorry for disturbing your weekend.

I've now distilled the code down to this

let proxyHandler = 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);
               """#)

private func cacheGet(context: JXContext, object _: JXValue?, args: [JXValue]) throws -> JXValue {
    let key = try args[1].stringValue
    // ... Get and return the JXValue
}

private func cacheSet(context: JXContext, object _: JXValue?, args: [JXValue]) throws -> JXValue {
    let key = try args[1].stringValue
    let value = 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?

ciao
Derek

Thank you! ๐Ÿ™๐Ÿป

(Couldn't find an obvious contact point so I'm using this)

Thank you for this repo! I'm finally able to use Ink using Swift on Linux. Great that it's so easy to convert from JavaScriptCore to JXKit.

Take care.

Documentation?

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?

Thanks!

License

LGPL is workable but I would suggest also making this available as MIT or the like, thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.