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
}