GithubHelp home page GithubHelp logo

Comments (4)

knopp avatar knopp commented on July 24, 2024 1

So it could be something like this

https://github.com/nativeshell/nativeshell/blob/nativeshell_plugin/nativeshell/src/shell/method_channel.rs

and this is how it would be used:

https://github.com/nativeshell/examples/blob/nativeshell_plugin/src/file_open_dialog.rs
https://github.com/nativeshell/examples/blob/nativeshell_plugin/src/platform_channels.rs
https://github.com/nativeshell/examples/blob/nativeshell_plugin/src/main.rs

from nativeshell.

knopp avatar knopp commented on July 24, 2024

Have you taken look at the examples? There are rust channel handlers registered with message manager.

https://github.com/nativeshell/examples/blob/main/src/platform_channels.rs
https://github.com/nativeshell/examples/blob/main/src/file_open_dialog.rs

If you want to you can even package your handler as a crate, all you'd need as an entry point is for your plugin to register with message manager.

from nativeshell.

maxjoehnk avatar maxjoehnk commented on July 24, 2024

Yeah I've seen the examples. But if you compare the api to the flutter-rs api it's way more cumbersome to work with.
In flutter-rs all you need to do is implement the trait MethodCallHandler and then you can register it with the engine.
There is also a Plugin trait which allows registration of channels to the engine.

For reference here you can find the usage of the Plugin trait and here you can see how the usage of the MethodCallHandler trait looks like.

from nativeshell.

knopp avatar knopp commented on July 24, 2024

I see. Would something like this work?

https://gist.github.com/knopp/139f7b2b02ce4f59e2649bc1560276c3

The Plugin struct is fairly easy to implement on top of existing machinery, but I don't mind including it if it makes things more convenient.

from nativeshell.

Related Issues (20)

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.