Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

event listener for when panel is opened?

Enthusiast ,
May 28, 2016 May 28, 2016

is there an event listener for when a CEP panel is opened.

i have a persistent panel so the onload only works when the panel is opened for the first time. i want to keep it persistent, but i want to know when the panel is being opened again

TOPICS
Scripting
1.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Participant , May 30, 2016 May 30, 2016

Perhaps I have misunderstood something, because my English is bad. Unfortunately listener for events at the opening of the panel, I also did not find, so I had to go a roundabout way.

Translate
Adobe
Participant ,
May 29, 2016 May 29, 2016

if you html5 panel, try: window.addEventListener ( 'focusin', function ( event ) {});

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 29, 2016 May 29, 2016

thanks alex, but that event triggers every time the user interacts with the panel. even if the panel never lost focus.

i had also tried focus, but that too triggers too many times. i want to know explicitly when the panel opens/expands.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 29, 2016 May 29, 2016

how about resize?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
May 30, 2016 May 30, 2016

resize does trigger when panel is closed.

@Alexander. ill try your solution. I was really just wondering if there was an event listener for that particular event. I Have a panel with peristent information and i want to reset some vars when a new session starts and keep others. So i dont want to close and reopen the panel and lookin for an even that only happens once the panel is deliberaly engaged.

so i was just wondering if the panel open was an actual event as i find the cep documentation very lacking.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 30, 2016 May 30, 2016
LATEST

Perhaps I have misunderstood something, because my English is bad. Unfortunately listener for events at the opening of the panel, I also did not find, so I had to go a roundabout way.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 29, 2016 May 29, 2016

And what purpose do you have? In Adobe Illustrator panel is loaded and there until the closure of the program or to a function call new CSInterface().closeExtension(); After calling this function, re-open your extension.

You can try another option.

Create a <input type="hidden" id="isActiveExt" value="0" />

And add 2 events:

window.addEventListener( 'focus', function ( event ) {

    var obj = document.querySelector('#isActiveExt');

    if ( !parseInt( obj.value ) ) {

        obj.value = 1;

        // your code

        console.log( 'Extension is active!' );

    }

});

window.addEventListener( 'blur', function ( event ) {

    var obj = document.querySelector('#isActiveExt');

    if ( parseInt( obj.value ) ) {

        obj.value = 0;

        console.log( 'Extension is deactive!' );

    }

});

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines