本文整理汇总了TypeScript中core/logger.warn函数的典型用法代码示例。如果您正苦于以下问题:TypeScript warn函数的具体用法?TypeScript warn怎么用?TypeScript warn使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了warn函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: function
var jsonp : AuthTransport = function(context : Browser, socketId, callback){
if(this.authOptions.headers !== undefined) {
Logger.warn("Warn", "To send headers with the auth request, you must use AJAX, rather than JSONP.");
}
var callbackName = context.nextAuthCallbackID.toString();
context.nextAuthCallbackID++;
var document = context.getDocument();
var script = document.createElement("script");
// Hacked wrapper.
context.auth_callbacks[callbackName] = function(data) {
callback(false, data);
};
var callback_name = "Pusher.auth_callbacks['" + callbackName + "']";
script.src = this.options.authEndpoint +
'?callback=' +
encodeURIComponent(callback_name) +
'&' +
this.composeQuery(socketId);
var head = document.getElementsByTagName("head")[0] || document.documentElement;
head.insertBefore( script, head.firstChild );
};
示例2: function
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var data, parsed = false;
try {
data = JSON.parse(xhr.responseText);
parsed = true;
} catch (e) {
callback(true, 'JSON returned from webapp was invalid, yet status code was 200. Data was: ' + xhr.responseText);
}
if (parsed) { // prevents double execution.
callback(false, data);
}
} else {
var suffix = UrlStore.buildLogSuffix("authenticationEndpoint");
Logger.warn(
`Couldn't retrieve authentication info. ${xhr.status}` +
`Clients must be authenticated to join private or presence channels. ${suffix}`
);
callback(true, xhr.status);
}
}
};
示例3: fetch
return fetch(request).then((response)=>{
let {status} = response;
if (status === 200) {
return response.text();
} else {
Logger.warn("Couldn't get auth info from your webapp", status);
throw status;
}
}).then((data)=>{
示例4: catch
}).then((data)=>{
try {
data = JSON.parse(data);
} catch (e) {
var message = 'JSON returned from webapp was invalid, yet status code was 200. Data was: ' + data;
Logger.warn(message);
throw message;
}
callback(false, data);
}).catch((err)=>{
示例5: function
xhr.onreadystatechange = function() {
if (xhr.readyState === 4) {
if (xhr.status === 200) {
var data, parsed = false;
try {
data = JSON.parse(xhr.responseText);
parsed = true;
} catch (e) {
callback(true, 'JSON returned from webapp was invalid, yet status code was 200. Data was: ' + xhr.responseText);
}
if (parsed) { // prevents double execution.
callback(false, data);
}
} else {
Logger.warn("Couldn't get auth info from your webapp", xhr.status);
callback(true, xhr.status);
}
}
};