本文整理匯總了TypeScript中@jupyterlab/documentsearch.SearchProviderRegistry.getProviderForWidget方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript SearchProviderRegistry.getProviderForWidget方法的具體用法?TypeScript SearchProviderRegistry.getProviderForWidget怎麽用?TypeScript SearchProviderRegistry.getProviderForWidget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類@jupyterlab/documentsearch.SearchProviderRegistry
的用法示例。
在下文中一共展示了SearchProviderRegistry.getProviderForWidget方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: SearchInstance
execute: () => {
const currentWidget = app.shell.currentWidget;
if (!currentWidget) {
return;
}
const widgetId = currentWidget.id;
let searchInstance = activeSearches.get(widgetId);
if (!searchInstance) {
const searchProvider = registry.getProviderForWidget(currentWidget);
if (!searchProvider) {
return;
}
searchInstance = new SearchInstance(currentWidget, searchProvider);
activeSearches.set(widgetId, searchInstance);
// find next and previous are now enabled
app.commands.notifyCommandChanged();
searchInstance.disposed.connect(() => {
activeSearches.delete(widgetId);
// find next and previous are now not enabled
app.commands.notifyCommandChanged();
});
}
searchInstance.focusInput();
}
示例2:
isEnabled: () => {
const currentWidget = app.shell.currentWidget;
if (!currentWidget) {
return;
}
return registry.getProviderForWidget(currentWidget) !== undefined;
},