本文整理匯總了TypeScript中rxjs/Rx.ReplaySubject.do方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ReplaySubject.do方法的具體用法?TypeScript ReplaySubject.do怎麽用?TypeScript ReplaySubject.do使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rxjs/Rx.ReplaySubject
的用法示例。
在下文中一共展示了ReplaySubject.do方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: run
function run() {
// debounce buffer
const validationRequestStream = new Rx.ReplaySubject<TextDocument>(1);
const validationFinishedStream = new Rx.ReplaySubject<{ uri: string; version: number }>(1);
const triggerUpdateConfig = new Rx.ReplaySubject<void>(1);
const triggerValidateAll = new Rx.ReplaySubject<void>(1);
// Create a connection for the server. The connection uses Node's IPC as a transport
const connection: IConnection = createConnection(new IPCMessageReader(process), new IPCMessageWriter(process));
g_connection = connection;
log('Start');
// Create a simple text document manager. The text document manager
// supports full document sync only
const documents: TextDocuments = new TextDocuments();
// After the server has started the client sends an initialize request. The server receives
// in the passed params the rootPath of the workspace plus the client capabilities.
let workspaceRoot: string | undefined;
connection.onInitialize((params: InitializeParams, token: CancellationToken): InitializeResult => {
workspaceRoot = params.rootPath || undefined;
return {
capabilities: {
// Tell the client that the server works in FULL text document sync mode
textDocumentSync: documents.syncKind,
codeActionProvider: true
}
};
});
// The settings have changed. Is sent on server activation as well.
connection.onDidChangeConfiguration(onConfigChange);
interface OnChangeParam { settings: Settings; }
function onConfigChange(change: OnChangeParam) {
log('onConfigChange');
Object.assign(vscodeSettings, change.settings || {});
log(`Enabled: ${vscodeSettings.cSpell && vscodeSettings.cSpell.enabled ? 'True' : 'False'}`);
triggerUpdateConfig.next(undefined);
}
function updateActiveSettings() {
log('updateActiveSettings');
CSpell.clearCachedSettings();
const configPaths = workspaceRoot ? [
path.join(workspaceRoot, '.vscode', CSpell.defaultSettingsFilename.toLowerCase()),
path.join(workspaceRoot, '.vscode', CSpell.defaultSettingsFilename),
path.join(workspaceRoot, CSpell.defaultSettingsFilename.toLowerCase()),
path.join(workspaceRoot, CSpell.defaultSettingsFilename),
] : [];
const cSpellSettingsFile = CSpell.readSettingsFiles(configPaths);
const { cSpell = {}, search = {} } = vscodeSettings;
const { exclude = {} } = search;
const importPaths = [...configsToImport.keys()].sort();
const importSettings = CSpell.readSettingsFiles(importPaths);
const mergedSettings = CSpell.mergeSettings(defaultSettings, importSettings, cSpellSettingsFile, cSpell);
const { ignorePaths = []} = mergedSettings;
const globs = defaultExclude.concat(ignorePaths, extractGlobsFromExcludeFilesGlobMap(exclude));
fnFileExclusionTest = generateExclusionFunctionForUri(globs, workspaceRoot || '');
Object.assign(activeSettings, mergedSettings);
activeSettingsNeedUpdating = false;
triggerValidateAll.next(undefined);
}
function getActiveSettings() {
if (activeSettingsNeedUpdating) {
updateActiveSettings();
}
return activeSettings;
}
function registerConfigurationFile(path: string) {
configsToImport.add(path);
log(`Load: ${path}`);
triggerUpdateConfig.next(undefined);
}
interface TextDocumentInfo {
uri?: string;
languageId?: string;
}
// Listen for event messages from the client.
connection.onNotification('applySettings', onConfigChange);
connection.onNotification('registerConfigurationFile', registerConfigurationFile);
connection.onRequest('isSpellCheckEnabled', (params: TextDocumentInfo) => {
const { uri, languageId } = params;
return {
languageEnabled: languageId ? isLanguageEnabled(languageId) : undefined,
fileEnabled: uri ? !isUriExcluded(uri) : undefined,
};
});
connection.onRequest('getConfigurationForDocument', (params: TextDocumentInfo) => {
const { uri, languageId } = params;
const doc = uri && documents.get(uri);
const docSettings = doc && getSettingsToUseForDocument(doc);
const settings = activeSettings;
//.........這裏部分代碼省略.........