Instantly share code, notes, and snippets.

@andersevenrud andersevenrud/index.js
Last active Jan 21, 2019

Embed
What would you like to do?
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