// plugin.js
ePoc.onLoad = () => {
// Executed when the plugin is loaded at ePoc startup
console.log('Hello World')
// The plugin returns the template name and shortcode for integration in text pages
return {
template: 'plugin_template.html',
shortcode: '[#hello_world]' // Shortcode to define here
};
}
<!-- plugin_template.html -->
<html lang="en">
<head>
<!-- Style sheet for identical display to the mobile app -->
<link rel="stylesheet" href="/assets/css/plugin-embed.css">
</head>
<body>
<h1>Hello World</h1>
<!-- Script to access the API -->
<script src="/assets/js/plugin-api-embed.js"></script>
<script>
// Your business logic here
</script>
</body>
</html>
// plugin.js
ePoc.onLoad = () => {
// Executed when the plugin is loaded at ePoc startup
console.log('Hello World')
// The plugin returns the template name and shortcode for integration in text pages
return {
template: 'plugin_template.html',
shortcode: '[#hello_world]' // Shortcode to define here
};
}
<!-- plugin_template.html -->
<!-- Custom question with free text field -->
<html lang="en">
<head>
<link rel="stylesheet" href="/assets/css/plugin-embed.css">
</head>
<body>
<form>
<!-- Text field -->
<input type="text"/>
</form>
<script src="/assets/js/plugin-api-embed.js"></script>
<script>
const userInput = document.querySelector('input');
// When the user types text
userInput.addEventListener('keyup', (event) => {
// Send the response to the app
plugin.emit('user-responded', userInput.value)
});
</script>
</body>