mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-28 00:45:04 +08:00
Migrate all usages of self.runtime to Root.Runtime.Runtime.instance(). This also requires various type updates, as now Closure/TypeScript can better understand the code and discover issues. R=jacktfranklin@chromium.org Bug: 1011811 Change-Id: Ice07aa0ca959e61a6acdf4618b9a272d8c1096b8 Fixed: 1081614 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2434339 Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org> Reviewed-by: Jack Franklin <jacktfranklin@chromium.org>
38 lines
1.0 KiB
JavaScript
38 lines
1.0 KiB
JavaScript
// Copyright 2019 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.
|
|
|
|
import * as Root from '../root/root.js';
|
|
|
|
/**
|
|
* @interface
|
|
*/
|
|
export class Linkifier {
|
|
/**
|
|
* @param {!Object} object
|
|
* @param {!Options=} options
|
|
* @return {!Node}
|
|
*/
|
|
linkify(object, options) {
|
|
throw new Error('linkify not implemented');
|
|
}
|
|
|
|
/**
|
|
* @param {?Object} object
|
|
* @param {!Options=} options
|
|
* @return {!Promise<!Node>}
|
|
*/
|
|
static linkify(object, options) {
|
|
if (!object) {
|
|
return Promise.reject(new Error('Can\'t linkify ' + object));
|
|
}
|
|
return /** @type {!Root.Runtime.Extension} */ (Root.Runtime.Runtime.instance().extension(Linkifier, object))
|
|
.instance()
|
|
.then(linkifier => /** @type {!Linkifier} */ (linkifier).linkify(/** @type {!Object} */ (object), options));
|
|
}
|
|
}
|
|
|
|
/** @typedef {{tooltip: (string|undefined), preventKeyboardFocus: (boolean|undefined)}} */
|
|
// @ts-ignore typedef.
|
|
export let Options;
|