Last active
April 21, 2022 21:49
-
-
Save andersevenrud/637ef06e47aa32a96a06789b36d9a623 to your computer and use it in GitHub Desktop.
OS.js v3 - Basic Iframe Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './index.scss'; | |
import osjs from 'osjs'; | |
import {name as applicationName} from './metadata.json'; | |
// Our launcher | |
const register = (core, args, options, metadata) => { | |
// Create a new Application instance | |
const proc = core.make('osjs/application', {args, options, metadata}); | |
// Create a new Window instance | |
proc.createWindow({ | |
id: 'FormIOWindow', | |
title: metadata.title.en_EN, | |
dimension: {width: 400, height: 400} | |
}) | |
.on('destroy', () => proc.destroy()) | |
.render($content => { | |
const iframe = document.createElement('iframe'); | |
iframe.style.width = '100%'; | |
iframe.style.height = '100%'; | |
iframe.setAttribute('border', '0'); | |
iframe.src = 'http://localhost:3001'; | |
$content.appendChild(iframe); | |
}); | |
return proc; | |
}; | |
// Creates the internal callback function when OS.js launches an application | |
osjs.register(applicationName, register); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment