本文整理匯總了TypeScript中neuroglancer/status.StatusMessage類的典型用法代碼示例。如果您正苦於以下問題:TypeScript StatusMessage類的具體用法?TypeScript StatusMessage怎麽用?TypeScript StatusMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了StatusMessage類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: makeDefaultViewer
export function makeDefaultViewer(options?: Partial<ViewerOptions>) {
disableContextMenu();
disableWheel();
try {
let display = new DisplayContext(document.getElementById('neuroglancer-container')!);
return new Viewer(display, options);
} catch (error) {
StatusMessage.showMessage(`Error: ${error.message}`);
throw error;
}
}
示例2: function
implementation.getNewTokenPromise = function() {
let status = new StatusMessage(/*delay=*/true);
let authPromise: Promise<Token>|undefined|null;
let tokenPromise = new Promise(function(resolve) {
function writeLoginStatus(
msg = 'Brain Maps authorization required.', linkMessage = 'Request authorization.') {
status.setText(msg + ' ');
let button = document.createElement('button');
button.textContent = linkMessage;
status.element.appendChild(button);
button.addEventListener('click', () => { login(/*immediate=*/false); });
status.setVisible(true);
}
function login(immediate: boolean) {
if (authPromise !== undefined) {
cancelPromise(authPromise);
}
writeLoginStatus('Waiting for Brain Maps authorization...', 'Retry');
authPromise = authenticateGoogleOAuth2({
clientId: BRAINMAPS_CLIENT_ID,
scopes: [BRAINMAPS_SCOPE],
immediate: immediate,
authUser: 0,
});
authPromise.then(
token => {
token['generationId'] = nextGenerationId++;
resolve(token);
},
reason => {
if (immediate) {
writeLoginStatus();
} else {
writeLoginStatus(`Brain Maps authorization failed: ${reason}.`, 'Retry');
}
});
callFinally(authPromise, () => { authPromise = undefined; });
}
login(/*immediate=*/true);
});
callFinally(tokenPromise, () => { status.dispose(); });
return tokenPromise;
};
示例3: writeLoginStatus
function writeLoginStatus(msg = 'Brain Maps authorization required.', linkMessage = 'Request authorization.') {
status.setText(msg + ' ');
let button = document.createElement('button');
button.textContent = linkMessage;
status.element.appendChild(button);
button.addEventListener('click', () => { login(/*immediate=*/false); });
status.setVisible(true);
}
示例4: callFinally
callFinally(tokenPromise, () => { status.dispose(); });