Skip to content

Instantly share code, notes, and snippets.

@andersevenrud
Last active April 21, 2022 21:49
Show Gist options
  • Save andersevenrud/637ef06e47aa32a96a06789b36d9a623 to your computer and use it in GitHub Desktop.
Save andersevenrud/637ef06e47aa32a96a06789b36d9a623 to your computer and use it in GitHub Desktop.
OS.js v3 - Basic Iframe Example
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