Giter Club home page Giter Club logo

goldengate's People

Contributors

adamsliwakowski avatar radex avatar

Stargazers

 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  avatar  avatar  avatar

Forkers

peter-moon

goldengate's Issues

Nicer syntax for calling methods from JavaScript

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.

@_callbackDeferreds is collecting garbage from no-return-value calls

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.

Passing functions to plugins

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)

Compatibility layer for Cordova plugins

Goldengate won't be a practical project if you have to rewrite all of your (and 3rd party) Cordova plugins to Goldengate.Plugins. It would be great to have some sort of a mechanism to map CDVPlugins to Goldengate plugins.

Some open questions:

  • how to do this, exactly? Use of objc runtime will be probably needed to discover all methods.
  • how to map return values to promises? With Cordova, you're essentially emitting a bit of JavaScript to call the callback function. Not very clean :(

Is it possible to work around the local URLs limitation?

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.

Ideas for built-in plugins

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",

  • device info
  • native app version
  • status bar text color
  • hide keyboard accessory view
  • splash screen (for smooth transition; only remove splash screen from screen when app says it's fully ready)

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.

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.