mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-11 14:14:36 +08:00
Move and rename files. NOAUTOREVERT=true NOPRESUBMIT=true NOTREECHECKS=true Bug: 768828 TBR=darin@chromium.org NOTRY=true Change-Id: I66d3b155808bc5bdbf237b80208e1e552bcf7f28 Reviewed-on: https://chromium-review.googlesource.com/1001153 Reviewed-by: Blink Reformat <blink-reformat@chromium.org> Commit-Queue: Blink Reformat <blink-reformat@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#549061} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 0aee4434a4dba42a42abaea9bfbc0cd196a63bc1
157 lines
3.3 KiB
JavaScript
157 lines
3.3 KiB
JavaScript
// Copyright 2014 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
/**
|
|
* @interface
|
|
*/
|
|
Common.Renderer = function() {};
|
|
|
|
Common.Renderer.prototype = {
|
|
/**
|
|
* @param {!Object} object
|
|
* @param {!Common.Renderer.Options} options
|
|
* @return {!Promise.<?Node>}
|
|
*/
|
|
render(object, options) {}
|
|
};
|
|
|
|
/**
|
|
* @param {?Object} object
|
|
* @param {!Common.Renderer.Options=} options
|
|
* @return {!Promise.<?Node>}
|
|
*/
|
|
Common.Renderer.render = function(object, options) {
|
|
if (!object)
|
|
return Promise.reject(new Error('Can\'t render ' + object));
|
|
return self.runtime.extension(Common.Renderer, object)
|
|
.instance()
|
|
.then(renderer => renderer.render(object, options || {}));
|
|
};
|
|
|
|
/** @typedef {!{title: (string|!Element|undefined), expanded: (boolean|undefined),
|
|
* editable: (boolean|undefined) }} */
|
|
Common.Renderer.Options;
|
|
|
|
/**
|
|
* @interface
|
|
*/
|
|
Common.Revealer = function() {};
|
|
|
|
/**
|
|
* @param {?Object} revealable
|
|
* @param {boolean=} omitFocus
|
|
* @return {!Promise.<undefined>}
|
|
*/
|
|
Common.Revealer.reveal = function(revealable, omitFocus) {
|
|
if (!revealable)
|
|
return Promise.reject(new Error('Can\'t reveal ' + revealable));
|
|
return self.runtime.allInstances(Common.Revealer, revealable).then(reveal);
|
|
|
|
/**
|
|
* @param {!Array.<!Common.Revealer>} revealers
|
|
* @return {!Promise.<undefined>}
|
|
*/
|
|
function reveal(revealers) {
|
|
const promises = [];
|
|
for (let i = 0; i < revealers.length; ++i)
|
|
promises.push(revealers[i].reveal(/** @type {!Object} */ (revealable), omitFocus));
|
|
return Promise.race(promises);
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @param {?Object} revealable
|
|
* @return {?string}
|
|
*/
|
|
Common.Revealer.revealDestination = function(revealable) {
|
|
const extension = self.runtime.extension(Common.Revealer, revealable);
|
|
if (!extension)
|
|
return null;
|
|
return extension.descriptor()['destination'];
|
|
};
|
|
|
|
Common.Revealer.prototype = {
|
|
/**
|
|
* @param {!Object} object
|
|
* @param {boolean=} omitFocus
|
|
* @return {!Promise}
|
|
*/
|
|
reveal(object, omitFocus) {}
|
|
};
|
|
|
|
/**
|
|
* @interface
|
|
*/
|
|
Common.App = function() {};
|
|
|
|
Common.App.prototype = {
|
|
/**
|
|
* @param {!Document} document
|
|
*/
|
|
presentUI(document) {}
|
|
};
|
|
|
|
/**
|
|
* @interface
|
|
*/
|
|
Common.AppProvider = function() {};
|
|
|
|
Common.AppProvider.prototype = {
|
|
/**
|
|
* @return {!Common.App}
|
|
*/
|
|
createApp() {}
|
|
};
|
|
|
|
/**
|
|
* @interface
|
|
*/
|
|
Common.QueryParamHandler = function() {};
|
|
|
|
Common.QueryParamHandler.prototype = {
|
|
/**
|
|
* @param {string} value
|
|
*/
|
|
handleQueryParam(value) {}
|
|
};
|
|
|
|
/**
|
|
* @interface
|
|
*/
|
|
Common.Runnable = function() {};
|
|
|
|
Common.Runnable.prototype = {
|
|
run() {}
|
|
};
|
|
|
|
/**
|
|
* @interface
|
|
*/
|
|
Common.Linkifier = function() {};
|
|
|
|
Common.Linkifier.prototype = {
|
|
/**
|
|
* @param {!Object} object
|
|
* @param {!Common.Linkifier.Options=} options
|
|
* @return {!Node}
|
|
*/
|
|
linkify(object, options) {}
|
|
};
|
|
|
|
/**
|
|
* @param {?Object} object
|
|
* @param {!Common.Linkifier.Options=} options
|
|
* @return {!Promise<!Node>}
|
|
*/
|
|
Common.Linkifier.linkify = function(object, options) {
|
|
if (!object)
|
|
return Promise.reject(new Error('Can\'t linkify ' + object));
|
|
return self.runtime.extension(Common.Linkifier, object)
|
|
.instance()
|
|
.then(linkifier => linkifier.linkify(object, options));
|
|
};
|
|
|
|
/** @typedef {{tooltip: string}} */
|
|
Common.Linkifier.Options;
|