Code Monkey home page Code Monkey logo

Comments (2)

shifujun avatar shifujun commented on May 22, 2024 3

刚刚提交了一个例子
d25da55

后面再补充其他场景。

from shadow.

shifujun avatar shifujun commented on May 22, 2024

这个问题被问到的确实多诶😅 我应该补几个例子。

先在这文字说明一下。

宿主和插件的Service,都可以跨进程的相互使用。

插件的Service由于没有在系统中注册,所以不能直接用context使用。要通过PPS上的startPluginService或者bindPluginService方法使用。

但是在同一个插件内部,是可以正常用context使用的。因为context是被Shadow管理的。

同一个进程中只能有一个Loader,一个Loader可以同时启动多个插件,所以一个Loader的多个插件之间也是可以直接用context使用Service的。

除了Service这种最工程化的通信手段。也可以允许插件访问宿主中的一些类,通过在白名单注册一些类,允许插件直接访问宿主的类。可以利用这一点,将宿主的一些类做成单独的jar,宿主打包,插件编译。

from shadow.

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.