Skip to content

Sharing service between App and plugins #21

Open
@jano42

Description

@jano42

Your work is amazing. (I've already search for such plugin system without finding a really good architecture.)

I'm relatively new to angular, and I don't master enough depecndencies injection with your example.

I just would like to go further than sharing components with plugins. What I want is to share a service (so my plugins could interact with app; it two ways : having methods to call app features; or being notified from app).

Here are headline of what I would like to do :

The serviceInterface :

export interface ISharedService{
    //the Obersable/event the plugin can register/subscribe to
    notificationEvent: Observable<string>;

   //a method call by plugins and executed on app
    doSometing(): void;
}

A plugin example:


  constructor(private sharedService: ISharedService) {
    this.sharedService.notificationEvent.subscribe( message => {
      
    });
  }

The service must be implemented on app side

Could it be realizable by the plugin architecture ?
I've tried without success, but my skills are limited on such project (I've tested with the branch share-lib-between-app-and-plugins)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions