On 2023-01-13 11:59, Igal Khitron wrote:
Hello. Could you tell me, please, is there a way to check if a window exists in manager by its symbolic name? hasWindow() does not except such a name. getWindow() returns empty window if it was not exists before. getWindow()...isInitialized() is always true. All I need is to check if the window "win1" exists, and if it's not, create it. Thank you.
Igal (User:IKhitron)

There doesn't seem to be a good way to do it.

If you really wanted to, you could do it like this:

  function isWindowRegistered( winManager, name ) {
    if ( winManager.windows[ name ] ) {
      return true;
    }
    if ( winManager.factory && winManager.factory.lookup( name ) ) {
      return true;
    }
    return false;
  }

However, these are not public APIs, and so I can't promise that they won't stop working in the future (or that you'll be notified when that happens).

I am curious about what you need this for, perhaps there's an easier way to achieve it. Can you share what you're building?


--
Bartosz Dziewoński
_______________________________________________
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

Reply via email to