osjs-client icon indicating copy to clipboard operation
osjs-client copied to clipboard

Maximize on render in a heavy application

Open mahsashadi opened this issue 2 years ago • 3 comments

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();
  });

mahsashadi avatar Jul 02 '22 13:07 mahsashadi

Have you tried maximizing before rendering ?

andersevenrud avatar Jul 02 '22 13:07 andersevenrud

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 with media-queries:

  • The very first loading is based on mobile dimension layout in any desktop-size, and updated after one second (in the case I set dimension: {width: 600, height: 600}, or not set)
  • If I set dimension with some desktop layout such as dimension: {width: 1600, height: 600} the problem is fixed, but maximize button on mobile device will enlarge app as it is not expected.
  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();

mahsashadi avatar Jul 03 '22 07:07 mahsashadi

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 ?

andersevenrud avatar Jul 28 '22 23:07 andersevenrud