Skip to content

Allow anonymous functions for updateKeys #543

@zbynek

Description

@zbynek

Is your feature request related to a problem? Please describe.
I would like to be able to use updateKeys with anonymous functions like this SafeExamBrowser.security.updateKeys(() => { ... }). Currently the argument of updateKeys needs to be a named function.

Describe the solution you'd like
I understand that updateKeys depends on the postMessage mechanism that can only send strings, but it should be possible for SEB to generate ID for any function it receives and keep a map from IDs to functions.

window.webkit.messageHandlers.updateKeys.postMessage(callback.name);

Describe alternatives you've considered
I can store the anonymous callbacks in an array myself and provide a global function that calls all of them, then use this global function as callback for SEB. But this adds complexity to client code and pollutes the global namespace.

Additional context

I ran into this issue on MacOS with SEB 3.6, didn't check iOS.

Metadata

Metadata

Assignees

Labels

feedback requiredThe original poster of the issue needs to provide more information or feedback to a question

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions