Add webContents.fromId
authorCheng Zhao <zcbenz@gmail.com>
Sat, 28 May 2016 01:10:24 +0000 (10:10 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Sat, 28 May 2016 01:10:24 +0000 (10:10 +0900)
atom/browser/api/atom_api_web_contents.cc
lib/browser/api/web-contents.js

index b38362972e01f570f8dc0ea3874004b51637748d..9f447f8e34e4cbc30b208a8d91140b7cdd1e1ee1 100644 (file)
@@ -1344,6 +1344,8 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
   mate::Dictionary dict(isolate, exports);
   dict.SetMethod("create", &atom::api::WebContents::Create);
   dict.SetMethod("_setWrapWebContents", &atom::api::SetWrapWebContents);
+  dict.SetMethod("fromId",
+                 &mate::TrackableObject<atom::api::WebContents>::FromWeakMapID);
 }
 
 }  // namespace
index 03697199836e31b3bebfc3bfa830ffe842539ccb..1b601f095dbb3d0ad612e29ffb84d1823a048e16 100644 (file)
@@ -226,9 +226,12 @@ binding._setWrapWebContents(wrapWebContents)
 debuggerBinding._setWrapDebugger(wrapDebugger)
 sessionBinding._setWrapSession(wrapSession)
 
-module.exports.create = function (options) {
-  if (options == null) {
-    options = {}
+module.exports = {
+  create (options = {}) {
+    return binding.create(options)
+  },
+
+  fromId (id) {
+    return binding.fromId(id)
   }
-  return binding.create(options)
 }