mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-09 21:28:43 +08:00
Bug: 1134103 Change-Id: I8339a3082d9d009f919e217cac59bec59921fb3d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2692891 Commit-Queue: Andres Olivares <andoli@chromium.org> Reviewed-by: Tim van der Lippe <tvanderlippe@chromium.org>
51 lines
1.2 KiB
JavaScript
51 lines
1.2 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'; // eslint-disable-line no-unused-vars
|
|
|
|
import {App} from './App.js'; // eslint-disable-line no-unused-vars
|
|
|
|
/**
|
|
* @interface
|
|
*/
|
|
export class AppProvider {
|
|
/**
|
|
* @return {!App}
|
|
*/
|
|
createApp() {
|
|
throw new Error('not implemented');
|
|
}
|
|
}
|
|
|
|
|
|
/** @type {!Array<!AppProviderRegistration>} */
|
|
const registeredAppProvider = [];
|
|
|
|
/**
|
|
* @param {!AppProviderRegistration} registration
|
|
*/
|
|
export function registerAppProvider(registration) {
|
|
registeredAppProvider.push(registration);
|
|
}
|
|
/**
|
|
* @return {!Array<!AppProviderRegistration>}
|
|
*/
|
|
export function getRegisteredAppProviders() {
|
|
return registeredAppProvider.sort((firstProvider, secondProvider) => {
|
|
const order1 = firstProvider.order || 0;
|
|
const order2 = secondProvider.order || 0;
|
|
return order1 - order2;
|
|
});
|
|
}
|
|
|
|
/**
|
|
* @typedef {{
|
|
* loadAppProvider: function(): !Promise<!AppProvider>,
|
|
* condition: Root.Runtime.ConditionName|undefined,
|
|
* order: number,
|
|
* }}
|
|
*/
|
|
// @ts-ignore typedef
|
|
export let AppProviderRegistration;
|