<p>Plugins can use <code>global.apis.eventbus</code> to receive events when certain actions happen in PostalPoint.</p>
<h2id="event-list">Event List</h2>
<ul>
<li><code>barcodeScanned</code>: Contents of a barcode that was just scanned, as a string. String also contains any non-printing characters in the barcode.</li>
<li><code>browserCloseRequest</code>: The embedded web browser listens for this event, and closes itself when received.</li>
<li><code>browserNavigate</code>: Contains the URL the embedded web browser just navigated to.</li>
<li><code>sendToCustomerScreen</code>: Emit to send data via <code>window.postMessage</code> to a custom HTML interface on the customer-facing display.</li>
<li><code>receiveFromCustomerScreen</code>: Contains the event sent from the customer-facing display's custom HTML interface via <code>window.parent.postMessage</code></li>
<li><code>transactionFinished</code>: Contains a receipt object of a transaction that was just finalized. See below for event data details.</li>
<li><code>customerSignatureCollected</code>: Contains a signature image from the customer-facing display. See below for event data details.</li>
<li><code>settingsSaved</code>: Emitted when PostalPoint's settings are saved. Usually this means the user changed a setting in the UI.</li>
<li><code>pluginSettingsSaved</code>: Emitted when the user saves a plugin's settings. The plugin ID string is sent as the event data.</li>
<li><code>packageCheckIn</code>: Emitted when a package is checked in to a mailbox or for Hold At Location. See below for event data details.</li>
<li><code>mailboxMailDelivered</code>: Emitted when mail delivery notifications are sent by the user. Data is an array of the mailbox numbers notifications are being sent for.</li>
</ul>
<h2id="example-code">Example Code</h2>
<divclass="language-javascript highlight"><pre><span></span><code><spanid="__span-0-1"><aid="__codelineno-0-1"name="__codelineno-0-1"href="#__codelineno-0-1"></a><spanclass="c1">// Handle a barcode scan.</span>
</span><spanid="__span-0-2"><aid="__codelineno-0-2"name="__codelineno-0-2"href="#__codelineno-0-2"></a><spanclass="c1">// Remember that PostalPoint will probably also be doing something in response to the barcode.</span>
</span><spanid="__span-0-4"><aid="__codelineno-0-4"name="__codelineno-0-4"href="#__codelineno-0-4"></a><spanclass="w"></span><spanclass="c1">// do something with the barcode</span>
</span><spanid="__span-0-7"><aid="__codelineno-0-7"name="__codelineno-0-7"href="#__codelineno-0-7"></a><spanclass="c1">// Close the embedded web browser, returning the user to whatever was onscreen before it opened</span>
</span><spanid="__span-2-2"><aid="__codelineno-2-2"name="__codelineno-2-2"href="#__codelineno-2-2"></a><spanclass="w"></span><spanclass="nx">tag</span><spanclass="o">:</span><spanclass="w"></span><spanclass="s2">"abcxyz123456"</span><spanclass="p">,</span><spanclass="w"></span><spanclass="c1">// Unique ID for the package, also found in the shelf label barcode.</span>
</span><spanid="__span-2-3"><aid="__codelineno-2-3"name="__codelineno-2-3"href="#__codelineno-2-3"></a><spanclass="w"></span><spanclass="nx">tracking</span><spanclass="o">:</span><spanclass="w"></span><spanclass="s2">"94001..."</span><spanclass="p">,</span><spanclass="w"></span><spanclass="c1">// Package tracking number. May be an empty string for items without tracking.</span>
</span><spanid="__span-2-4"><aid="__codelineno-2-4"name="__codelineno-2-4"href="#__codelineno-2-4"></a><spanclass="w"></span><spanclass="nx">carrier</span><spanclass="o">:</span><spanclass="w"></span><spanclass="s2">"FedEx"</span><spanclass="p">,</span><spanclass="w"></span><spanclass="c1">// Package carrier name, if detectable from the tracking number. Otherwise an empty string.</span>
</span><spanid="__span-2-5"><aid="__codelineno-2-5"name="__codelineno-2-5"href="#__codelineno-2-5"></a><spanclass="w"></span><spanclass="nx">mailbox</span><spanclass="o">:</span><spanclass="w"></span><spanclass="s2">"123"</span><spanclass="p">,</span><spanclass="w"></span><spanclass="c1">// Mailbox number. Will be "HAL" for Hold At Location packages.</span>
</span><spanid="__span-2-6"><aid="__codelineno-2-6"name="__codelineno-2-6"href="#__codelineno-2-6"></a><spanclass="w"></span><spanclass="nx">isHAL</span><spanclass="o">:</span><spanclass="w"></span><spanclass="kc">false</span><spanclass="p">,</span><spanclass="w"></span><spanclass="c1">// True if package is for Hold At Location.</span>
</span><spanid="__span-2-7"><aid="__codelineno-2-7"name="__codelineno-2-7"href="#__codelineno-2-7"></a><spanclass="w"></span><spanclass="nx">recipient</span><spanclass="o">:</span><spanclass="w"></span><spanclass="s2">""</span><spanclass="p">,</span><spanclass="w"></span><spanclass="c1">// Hold At Location recipient name, or empty string if not HAL.</span>
</span><spanid="__span-2-8"><aid="__codelineno-2-8"name="__codelineno-2-8"href="#__codelineno-2-8"></a><spanclass="w"></span><spanclass="nx">toLocker</span><spanclass="o">:</span><spanclass="w"></span><spanclass="s2">"5"</span><spanclass="p">,</span><spanclass="w"></span><spanclass="c1">// Parcel locker number, or false if not going to a parcel locker.</span>
</span><spanid="__span-2-9"><aid="__codelineno-2-9"name="__codelineno-2-9"href="#__codelineno-2-9"></a><spanclass="w"></span><spanclass="nx">shelfLabelPrinted</span><spanclass="o">:</span><spanclass="w"></span><spanclass="kc">true</span><spanclass="w"></span><spanclass="c1">// Indicates if a shelf label was printed for this package. Will be false if going to a locker, if the user requested no label, or if the label failed to print.</span>
<scriptid="__config"type="application/json">{"annotate":null,"base":"../..","features":["content.code.copy"],"search":"../../assets/javascripts/workers/search.2c215733.min.js","tags":null,"translations":{"clipboard.copied":"Copied to clipboard","clipboard.copy":"Copy to clipboard","search.result.more.one":"1 more on this page","search.result.more.other":"# more on this page","search.result.none":"No matching documents","search.result.one":"1 matching document","search.result.other":"# matching documents","search.result.placeholder":"Type to start searching","search.result.term.missing":"Missing","select.version":"Select version"},"version":{"provider":"mike"}}</script>