Capture When Session Has Loaded

I'd highly recommend you check out @bmusson 's module which integrates toastify:

If it helps, I wrote this small libarary with a function to call the toast notification:

# LIBRARY: shared.fe.perspective.toast
class ToastType:
	INFO = 'info'
	SUCCESS = 'success'
	WARNING = 'warning'
	ERROR = 'error'


def showToast(content, toastType=ToastType.INFO, autoClose=5000):
	"""
	Shows a toast notification to the user.
	Required Modules:
		Embr-Periscope
	
	"""
	args = {
		'content': content,
		'options': {
			  "autoClose": 5000,
			  "closeButton": True,
			  "closeOnClick": False,
			  "draggable": True,
			  "hideProgressBar": False,
			  "icon": True,
			  "pauseOnFocusLoss": False,
			  "pauseOnHover": True,
			  "position": "bottom-center",
			  "theme": "colored",
			  "type": toastType
			}
		}
	system.perspective.runJavaScriptAsync('''(content, options) => {		
		periscope.toast(content, options)
	}''', args)

Call it like this:

shared.fe.perspective.toast.showToast('Hello!', shared.fe.perspective.toast.ToastType.SUCESS)

Note: "fe" stands for FrontEnd, if you are wondering

2 Likes