Skip to content
Snippets Groups Projects
viamapi-client.js 392 B
Newer Older
  • Learn to ignore specific revisions
  • const Penpal = require('penpal').default;
    
    function setupViamAPI(divId, methodsArg) {
    	const connection = Penpal.connectToChild({
    	  // URL of page to load into iframe.
    	  url: '{{urlArg}}',
    	  // Container to which the iframe should be appended.
    	  appendTo: document.getElementById(divId),
    	  // Methods parent is exposing to child
    	  methods: methodsArg
    	});
    
    	return connection.promise
    }