os-js / osjs-client

OS.js Client Module
https://manual.os-js.org/
Other
31 stars 31 forks source link

Maximize on render in a heavy application #180

Open mahsashadi opened 2 years ago

mahsashadi commented 2 years ago

I have an application which is heavy to load. Although I maximize it in render event, there is a delay (means the user see app in its default dimension and after 1 or 2 seconds it is maximized). How can I initially have my app full screen without any dealy?

  // Create  a new Window instance
  const win = proc.createWindow({
    id: 'ExampleReactApplicationWindow',
    title: metadata.title.en_EN,
    dimension:{width: 600, height: 750},
    position: {left: 0, top: 0},
    icon: proc.resource(metadata.icon),
    attributes: {
      mediaQueries: {
        customBig: 'screen and (max-width: 1500px)',
        customMedium: 'screen and (max-width: 1000px)',
        customSmall:'screen and (max-width: 768px)'
      },
      minDimension:{width: 600, height: 750},
      clamp: false,
    },
  });

  win.on('render', () => {
    win.maximize();
    win.focus();
  });
andersevenrud commented 2 years ago

Have you tried maximizing before rendering ?

mahsashadi commented 2 years ago

Have you tried maximizing before rendering ?

Yes, no delay happened for maximizing in this way, thanks.

Another problem happened due to having a responsive layout withmedia-queries:

  const win = proc.createWindow({
    id: 'ExampleReactApplicationWindow1',
    title: metadata.title.en_EN,
    dimension: {width: 600, height: 800},
    position: {left: 0, top: 0},
    icon: proc.resource(metadata.icon),
    attributes: {
      mediaQueries: {
        customBig: 'screen and (max-width: 1500px)',
        customMedium: 'screen and (max-width: 1100px)',
        customSmall:'screen and (max-width: 768px)'
      },
      minDimension:{width: 600, height: 800},
      clamp: false,
    },
  });

  win.maximize();
andersevenrud commented 2 years ago

but maximize button on mobile device will enlarge app as it is not expected.

Sorry. I'm not exactly sure what you mean by this.

Could you share some screenshots to illustrate the issue ?