WPSJS加载项技术介绍

1. CEF技术介绍

        JS加载项以CEF为技术基础,加载项的JS代码是运行在CEF内部的。CEF内部提供接口比如执行JS代码

CefRefPtr browser = ...;

CefRefPtr frame = browser->GetMainFrame();

frame->ExecuteJavaScript("alert('ExecuteJavaScript works!');",frame->GetURL(), 0);

比如JS对象绑定

void MyRenderProcessHandler::OnContextCreated(

    CefRefPtr browser,

    CefRefPtr frame,

    CefRefPtr context) 
{
  // Retrieve the context's window object.
  CefRefPtr object = context->GetGlobal();

  // Create a new V8 string value. See the "Basic JS Types" section below.
  CefRefPtr str = CefV8Value::CreateString("My Value!");

  // Add the string to the window object as "window.myval". See the "JS Objects" section below.
  object->SetValue("myval", str, V8_PROPERTY_ATTRIBUTE_NONE);
}

JS加载项在这些技术的基础上面开发完整的JSAPI的接口,更多CEF的技术细节

可以查看下面的网站:

chromiumembedded / cef / wiki / Home — Bitbucket

2. Ribbon customUI设计

你可能感兴趣的:(JSAPI二次开发,javascript)