Files
react-native-devtools-frontend/front_end/common/Linkifier.js
T
Tim van der Lippe 7f2002c598 [globals] self.runtime
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>
2020-09-29 10:52:39 +00:00

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;