index.ts 502 B

12345678910111213141516
  1. /**
  2. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. */
  6. import { PluginContext } from './context';
  7. import { Plugin } from './ui/plugin'
  8. import * as React from 'react';
  9. import * as ReactDOM from 'react-dom';
  10. export function createPlugin(target: HTMLElement): PluginContext {
  11. const ctx = new PluginContext();
  12. ReactDOM.render(React.createElement(Plugin, { plugin: ctx }), target);
  13. return ctx;
  14. }