Closed
Description
Area of Issue
[ ] App Directory
[X] API
[ ] Context Data
[ ] Intents
[ ] Use Cases
[ ] Other
Issue Description:
The argument order in the two addContextListener
overloads of DesktopAgent
complicates implementation.
addContextListener(handler: ContextHandler): Listener;
addContextListener(contextType: string, handler: ContextHandler): Listener;
Means you have to use union types to implement in TypeScript:
addContextListener(a: ContextHandler | string, b?: ContextHandler): Listener {
var handler = a as ContextHandler;
var contextType = null;
if (typeof a !== "function") {
contextType = a as string;
handler = b as ContextHandler;
}
...
I suggest we flip the argument order in the second version:
addContextListener(handler: ContextHandler): Listener;
addContextListener(handler: ContextHandler, contextType: string): Listener;