radex / goldengate Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Instead of:
Goldengate.dispatch('Foo', 'bar', [args])
I'd like:
Goldengate.Foo.bar(args)
I don't think you can catch calls of undefined methods like that, so instead we have to pass the list of routes across the bridge at start — before any calls — and create those "classes" and methods.
All calls to Goldengate.dispatch create a Deferred object and save it onto a map. Problem is, if the call doesn't return anything, the Deferred stays there forever.
Unlikely to be a real problem in most applications, but a memory leak nonetheless.
If we do #1, the fix we'll be trivial — we'll know on JS side which methods never return a value and just never create or return the deferred.
At the moment, you can only pass simple values (numbers, booleans, strings), arrays and dictionaries/objects across the bridge to Swift. I think it would be useful to be able to pass a function as an argument. Sometimes you want to call JS from native code in response to some events or whatever. One way to do it is to hard-code JS method names in native plugins. But often it might be cleaner/easier to pass a reference to the function at caller site.
Downside is that it requires some additional processing on both sides of the bridge. We'd have to save the reference somewhere, give it a unique ID and code it in the passed arguments somehow — e.g. pass it as ['function', 123]
(we'd have to code arrays as ['array', [...]]
or something to disambiguate, which is a little silly)
Goldengate won't be a practical project if you have to rewrite all of your (and 3rd party) Cordova plugins to Goldengate.Plugin
s. It would be great to have some sort of a mechanism to map CDVPlugins to Goldengate plugins.
Some open questions:
I'm a little worried that albeit local URL loading was added, it won't ship until iOS 9. Even if they do ship it in iOS 8.2, OS X will surely have to wait until 10.11. That's kinda too long to wait.
Is it possible to (somehow!) work around this? Somehow fake a local server, perhaps? I doubt it's possible, but even if you can do it on one of the platforms, that's better than nothing.
The idea is that Goldengate is a very lightweight library, not a full-fledged framework with a plugin for everything. But I think it would be useful to include some common tasks into the "standard library",
I'll probably want to write some other things, like file IO, but perhaps it would be better to put them in a separate repo.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.