diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index b38362972e..9f447f8e34 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1344,6 +1344,8 @@ void Initialize(v8::Local exports, v8::Local unused, mate::Dictionary dict(isolate, exports); dict.SetMethod("create", &atom::api::WebContents::Create); dict.SetMethod("_setWrapWebContents", &atom::api::SetWrapWebContents); + dict.SetMethod("fromId", + &mate::TrackableObject::FromWeakMapID); } } // namespace diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index 0369719983..1b601f095d 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -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) }