question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Working example of popup auto closure

See original GitHub issue

Can we have a documented example of how to setup the popup auto close function. I have tested using the following defined on TYPES.POPUP and it is not working:

                         action: function (item, entity) {
                         this.$scope.openPopup(item, entity);
                         setTimeout(function () {
                           this.$scope.closePopup();
                         }, '1000');},

The popup opens as expected and after the timeout of 1 second the following error is seen on the screen and in the browser console and the popup does not close:

Uncaught TypeError: Cannot read property ‘closePopup’ of undefined

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
FaiekAcommented, Aug 23, 2021

@flick116 Hi - I managed to get it work , I’m sure that this is probably not correct, but does work with a small issues it seems - whereby the popup would close unexpectedly if you go back within the 5 seconds.

{
  position: [0, 1],
  type: TYPES.POPUP,			  
  id: {},
  icon: "mdi-home-group",
  title: "Home Scenes",
  customStyles: {
  "background-color": "#7dba81",},			  
  height: 1,
  state: false,		  
  popup: {
	tileSize: 100,
	items: [
{
	position: [0, 0],
	width: 2,
	title: "Guest Mode",
	classes: [CLASS_BIG],
	type: TYPES.INPUT_BOOLEAN,					
	id: "input_boolean.guest_mode",
	icons: {
		  on: "mdi-account-multiple-plus",
		  off: "mdi-account-multiple-outline",
},
	customStyles: function (item, entity) {
	if (entity.state === "off") {
	return { backgroundColor: "#898c80" };
	} else {
	return { backgroundColor: "red" };
	}
},
	states: {
	  on: "Guests",
	  off: "No Guests",
	},	
	state: function (item, entity) {
	this.$scope.entityClick.bind(this);	
    setTimeout(this.$scope.closePopup.bind(this), 5000); },
},

		],	

},
},

I requested help on the Q&A and hoping to get some help #758 Hope this helps in the interim.

0reactions
FaiekAcommented, Jul 11, 2022

@Erelen-Laiquendi - Thanks a mill this works - flawlessly Finally - thanks again

Read more comments on GitHub >

github_iconTop Results From Across the Web

modal popup closing automatically after few seconds using ...
closedialog #automaticallypopupclose#jquerymodelpopupjquery snippet to close modal popup automatically after 5 or 10 seconds.
Read more >
Auto Close popup window - Oracle Communities
Hi All, Apex 4.2.1. Can someone know how to do following please? I have page (IR) report and link that open a popup...
Read more >
Javascript to automatically close a popup window
I have the following code (listed below). In short, when a user clicks the button "All On" it will open a popup window...
Read more >
Popups and window methods - The Modern JavaScript Tutorial
Popups exist from really ancient times. The initial idea was to show another content without closing the main window.
Read more >
Issue in pop up close - SAP Community
The popup window will get closed automatically if you perfrom any action say for example selecting a single result field or pressing a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found