Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

...

  1. Native Context: Listening for the WebViewJavascriptBridgeReady Document event. Native context implies a document loaded through native Pulsar interactions. This includes: launching from an object detail page, a home page tab, a home page replacement app, launching from the content library, loaded from PSL or a Lightning Bolt Menu action.
    IMPORTANT: Prior to Pulsar 12.0, you must call the init method on the bridge before you use it. The function you provide here will receive messages sent over the bridge. This is a great place to add some debug logging as you develop your application.

    Code Block
    languagejs
    let pulsarJSBridge;
    document.addEventListener('WebViewJavascriptBridgeReady', function(event) {
      pulsarJSBridge = event.bridge;
      
      // the presence of pulsarJSBridge.version implies that we are running Pulsar 12.0
      if (typeof pulsarJSBridge.version === 'undefined') {
        pulsarJSBridge.init( function(message, responseCallback) {
          // Add a log for every message that is sent to the Pulsar JS Bridge
          console.log('PulsarJSBridge received message: ', message);
        } );
      }
      
      // you can now make use of pulsarJSBridge!
      // Read on to learn how to send and receive messages as well as best practices for setting up the bridge.
    }, false);

  2. Embedded Context: Copying it from window.parent.pulsar. Embedded context implies a document loaded through the Pulsar Field Service Lightning application.

    Code Block
    languagejs
    let pulsarJSBridge, pulsar;
    if (window.parent.pulsar && window.parent.pulsar.bridge) {
      pulsar = window.parent.pulsar;
      pulsarJSBridge = window.parent.pulsar.bridge;
      // there is no need to call init on this version of the bridge as it has already been initialized by Pulsar for SFS
    } else {
      console.warn('Something is wrong, unable to locate the Pulsar JS Bridge. Are you sure you are in an embedded state?')
    }

...

  1. dispatchToHomeApp’ – issued by Pulsar to communicate with the home page replacement app. When Pulsar for SFS is enabled, this sends messages intended for use by Pulsar for SFS.

  2. 'invalidateLayout’ – issued by Pulsar when we have received an update to the Salesforce objects layout information. An application may need to re-read layout or schema information in this case in order to re-render a layout properly.

  3. syncDataStarted’ – issued by Pulsar to indicate that a data sync has started.

  4. syncDataUpdate’ – issued by Pulsar to inform an update about the status of a sync. Information in this message will include a percentage complete.

  5. syncDataCoreFinished’ – issued by Pulsar when the data part of a sync has completed. Indicating that documents or images may still need to be sync’d.

  6. syncDataFinished’ – issued by Pulsar to indicate that the sync is completed.

  7. custom_oauth’ – issued by Pulsar when an external or internal custom OAuth 2.0 flow has completed and the pulsar custom_oauth callback deep link is used. (this is a Pulsar 12.0.0 feature)

getDocumentPath

This method is used to generate a path to a given document node in your custom app. It takes a document node as an argument and will walk the DOM and build a string that can be used by native Pulsar when generating PDFs. This was designed specifically for this function and was meant to help construct arguments for PDF generation, namely providing the header, body and footer nodes.

...