Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create view message bus #1297

Closed
tbosch opened this issue Apr 10, 2015 · 7 comments
Closed

Create view message bus #1297

tbosch opened this issue Apr 10, 2015 · 7 comments
Assignees

Comments

@tbosch
Copy link
Contributor

tbosch commented Apr 10, 2015

----
Render API:

class RenderMessageRef {}

class Renderer {
  sendMessage(view:ViewRef, type:string, data:StringMap):RenderMessageRef;
  setMessageDispatcher(view:ViewRef, dispatcher:MessageDispatcher)
}

class MessageDispatcher {
  dispatchMessage(type:string, data:StringMap, inReplyTo:RenderMessageRef)
}

------
App side:

class AppView {
  sendRenderMessage(type:string, data:StringMap):RenderMessageRef;
  waitFor(List<RenderMessageRef>):Promise<List<any>>
}

-----
Render side (under src/render/dom):

class MessageManager {
  handlers:List<MessageHandler>
}

class MessageHandler {
  supports(type:string):boolean;
  handle(view:View, type:string, data:StringMap, messageRef:RenderMessageRef)
}

class View {
  sendAppMessage(type:string, data:StringMap, inReplyTo:RenderMessageRef)
}
@tbosch
Copy link
Contributor Author

tbosch commented Apr 10, 2015

Very similar to EventDispatcher and EventManager/EventHandler

@pkozlowski-opensource
Copy link
Member

@tbosch in the AppView interface you were proposing sendRenderMessage(type:string, data:StringMap):RenderMessageRef; but IMO we should also have a way of referencing individual elements. For example the class directive is a decorator directive that allows toggling classes on a particular element within a View.

So 2 questions here:

  • How the proposed API would allow me to specify a particular element? Shell we add ElementRef or similar to this API?
  • How a decorator directive could get a reference to the enclosing View? Is it injectable?

Sorry if this is messed up in my head, but before implementing those services I would like to understand how those would fit / play together in the real-life use case (class directive)

@tbosch
Copy link
Contributor Author

tbosch commented Apr 15, 2015

Pawel, you can reference elements within a regular angular view via a bound
element index, which you can get on the app side via ElementRef.
However, imperative views will have their own way of locating elements (eg
a css selector, ...).

That's why the general interface of the MessageBus has no notion of a
location, assuming the location will be part of the data map.
On Wed, Apr 15, 2015 at 6:44 AM Pawel Kozlowski notifications@github.com
wrote:

@tbosch https://github.com/tbosch in the AppView interface you were
proposing sendRenderMessage(type:string, data:StringMap):RenderMessageRef;
but IMO we should also have a way of referencing individual elements. For
example the class directive
https://github.com/angular/angular/blob/master/modules/angular2/src/directives/class.js
is a decorator directive that allows toggling classes on a particular
element within a View.

So 2 questions here:

  • How the proposed API would allow me to specify a particular element?
    Shell we add ElementRef or similar to this API?
  • How a decorator directive could get a reference to the enclosing
    View? Is it injectable?

Sorry if this is messed up in my head, but before implementing those
services I would like to understand how those would fit / play together in
the real-life use case (class directive)


Reply to this email directly or view it on GitHub
#1297 (comment).

@pkozlowski-opensource
Copy link
Member

OK, I see, thnx.

@mhevery mhevery added this to the m*: WebWorker milestone Apr 28, 2015
@tbosch
Copy link
Contributor Author

tbosch commented May 1, 2015

Hi, I think this concept gets obsolete!
We have events for render -> app side communication, actions for app -> render side communication and imperative views. Together, they should allow to do anything!

@tbosch tbosch closed this as completed May 1, 2015
@pkozlowski-opensource
Copy link
Member

Wow, good to hear, since I wasn't that keen on this message bus and was struggling a bit with the impl. Will look at the actions.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants