Usage
nebula.postMessage(data)
Parameters
data
(Required) (Mixed) A string, object, or valid data to pass as a message to the service worker
Default: None
Examples
Send a simple string as a message
nebula.postMessage('This is a test!');
Send an object as a message
nebula.postMessage({ demo: jQuery('#message').val() });
Additional Notes
This function is essentially an alias for navigator.serviceWorker.controller.postMessage(data)
, but it also checks if Service Worker is supported and if there is currently a controller, so it is safe to use anywhere.
Remember: Using shift+reload bypasses the service worker so the window will not be controlled! This prevents messages from being posted!
Source File
This function was not found in /assets/js/modules/utilities.js. Please report this error.
No Hooks
This function does not have any filters or actions available. Request one?Override
To override or disable this JavaScript function, simply redeclare it with the exact same function name. Remember: Some functionality is conditionally loaded via dynamic imports, so if your function is not overriding properly, try listening for a DOM event (described below).
function postMessage(data){ //Write your own code here, leave it blank, or return false. }