Browse Prior Art Database

An method for 1-1 Communication between JavaScript Widgets

IP.com Disclosure Number: IPCOM000237362D
Publication Date: 2014-Jun-16
Document File: 2 page(s) / 86K

Publishing Venue

The IP.com Prior Art Database

Abstract

This article introduces a new approach for handling information communications between JavaScript widgets(Ojbects), which performs better than existing approaches when communications between one widget and another. In this approach, widgets register nick names in third-part registry, and send message to specific widget via a safe mechanism.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 56% of the total text.

Page 01 of 2

An method for

An method for

1-1 1-1

1-1

Communication between JavaScript Widgets Communication between JavaScript Widgets

JavaScript language is wildly used in modern web applications. Most UI widgets in web page, are implemented in js Objects. And some widgets need to share information or send notification to others (related to UI changes). Generally there are two school of approaches to implement this behavior:

A. method invocation: If Widget X need to share some info or send a notification to Widget Y,

firstly, as in design phase, Y define a method (e.g. handler ) to handle the info/notification;

then, in inner code, X need to hold a reference to Y;

finally, at run-time X will invocation: Y.handler(info).


B. message-bus:

Widgets will not directly communicate with each other. As an infrastructure, there is a message-bus, widgets send messages/receive messages via this bus. As an example, JavaScript toolkit dojo, define two functions:

publish(topic, message)

subscribe(topic, handler)

Widgets that are interested in each other(or other more widgets), can share a string topic.

This idea offers a new approach to implement widgets communication, especially communication between one to another.

Core Idea:

Related widgets get in touch with each other by Nick Name in a third-party registry (

Point I

Point II

sending message (

).

), and communicate with each other via

Advantages:

A. Compare to method invocation: 1. loose coupling (easy to design)

2. more safety

3. more maintainability
B. Compare to message-bus: 1. more effective

2. less impact to other widgets

3. easy to detect name(topic) conflict

1



Page 02 of 2

As a sim...