No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Quasar project use Epson ePOS SDK for JavaScript to print!

    Help
    2
    2
    468
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      JackyLee last edited by

      Hi, I’m trying to use the Epson ePOS SDK for JavaScript for my Quasar project;
      the SDK is an IIFE, something like jQuary and expose an object of epson to browser’s window

      (function(window, undefined) { 
      ....
      ....
      if (!window.epson) {
          window.epson = {};
        }
        window.epson.ePOSDevice = ePOSDevice;
        window.epson.ePOSDeviceConfiguration = ePOSDeviceConfiguration;
      })(window)
      

      in the browser, the Epson manual says to use it in a HTML script tag:

      Scripts are embedded into Web pages using HTML <script> tags.
      Embedding Example
      <script type="text/javascript" src="epos-2.14.0.js"></script>
      

      My question is how to use this SDK in the Quasar project ?

      1 Reply Last reply Reply Quote 0
      • J
        jraez last edited by

        You can add the script through Meta plugin https://quasar.dev/quasar-plugins/meta

        Then, I would do a boot file ton inject something like $printer into the app

        export default async ({ Vue }) => {
          Vue.mixin({
            computed: {
              $printer () { 
                   return {
                       ePOSDevice: ePOSDevice,
                       ePOSDeviceConfiguration: ePOSDeviceConfiguration
                   }
              }
            }
          })
        }
        

        Then in any vue component, you’ll able to access it like “this.$printer”

        1 Reply Last reply Reply Quote 0
        • First post
          Last post