Coder Social home page Coder Social logo

vmt-widget's Introduction

Venue Mapping Tool Widget

Implementation Guide

Note: VMT Widget was bundled and exported as UMD module, so you can:

  1. Install vmt-widget package via bower:
    • add 'vmt-widget' dependency to the bower.json file(example):
    {
      "name": "vmt-widget-example",
      "version": "0.0.1",
      "dependencies": {
        "vmt-widget": "[email protected]:yvelianyk/vmt-widget.git"
      }
    }
    
    
    • install bower dependencies:
    bower install
    
    • include VMT Widget script into your index.html file:
        
    <script src="bower_components/vmt-widget/dist/bundle.js"></script>
    • get VMTWidget variable from global window scope:
    let vmtWidget = VMTWidget.default;
  2. Install vmt-widget package via npm:
    • install dependency:
    npm i -save git+ssh://[email protected]:yvelianyk/vmt-widget.git
    
    • import VMT widget in some of your *.js file:
    import vmtWidget from 'vmt-widget';

Usage

  1. Launching VMT widget:
    • get vmtWidget instance:
    import vmtWidget from 'vmt-widget';
    OR(if VMTWidget variable is in global window scope)
    let vmtWidget = VMTWidget.default;
    • launch widget with options(example):
    vmtWidget.launch({
       containerId: 'venue-mapping-tool', // html element id in which VMT widget will be load
       apiPoint: 'http://some.api.host',
       memberId: 123,
       venueId: 123,
       mode: 'tickets', // can be also 'picker'. If undefined it means 'edit' mode
       token: 'someAccessToken',
       styles: 'someCssProp: 10px;', // inject custom inline css styles for iframe (optionally)
       eventId: 123});
  2. Listen VMT Widget internal methods calling:
    • when user checkout some tickets(in the picker mode) we need register method for it. Callback function receives token and tickets parameters.\n Example:
    vmtWidget.method('checkoutTickets', function (token, tickets) {
        console.log('CHECKOUT TICKETS: ', token, tickets);
        return {success: true, message: `${tickets.length} ticket was checkout successfully!`};
    });
    • also, VMT Widget provides onClose hook for catching event when VMT Widget was closed:
    vmtWidget.onClose(() => {
        console.log('WIDGET WAS CLOSED');
    });

vmt-widget's People

Contributors

mykhailomaliarchuk avatar

Watchers

James Cloos avatar Yaroslav Velianyk avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.