本文整理汇总了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 );
};
开发者ID:Nabobil,项目名称:pusher-js,代码行数:25,代码来源:jsonp_auth.ts
示例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);
}
}
};
开发者ID:pusher,项目名称:pusher-js,代码行数:25,代码来源:xhr_auth.ts
示例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)=>{
开发者ID:pusher,项目名称:pusher-js,代码行数:9,代码来源:fetch_auth.ts
示例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)=>{
开发者ID:pusher,项目名称:pusher-js,代码行数:10,代码来源:fetch_auth.ts
示例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);
}
}
};
开发者ID:Nabobil,项目名称:pusher-js,代码行数:21,代码来源:xhr_auth.ts
注:本文中的core/logger.warn函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论