Bridge constructor

Bridge(
  1. String script
)

Implementation

Bridge(this.script)
{
  /////////////////////////////////////
  /* Contructor Callback from Script */
  /////////////////////////////////////
  JAVASCRIPT.context["flutter"] = (content)
  {
    _connector = content;

    //////////////////
    /* Add Listener */
    //////////////////
    HTML.window.removeEventListener('message', _receive);
    HTML.window.addEventListener('message', _receive);

    return id;
  };

  //////////////////////////
  /* Register HTML iFrame */
  //////////////////////////
  // ignore: undefined_prefixed_name
  UI.platformViewRegistry.registerViewFactory(id, (int viewId)
  {
    final HTML.IFrameElement _frame = HTML.IFrameElement();
    _frame.id     = id;
    _frame.width  = '100%';
    _frame.height = '100%';
    _frame.src    = script;
    return _frame;
  });

}