捕捉浏览器中的JS运行时错误,主要通过监听window.onerror来实现。但是对于不同的脚本执行方式以及不同的浏览器,能捕获到的信息会有区别。
window.onerror 讲接收3个参数:
msg
:错误描述,比如:a is not definedurl
:出错脚本所在的urllineNumber
:出错脚本的行数
本文将对不同浏览器和不同的脚本执行方式进行测试,并总结这些区别。
/** | |
* 版本1 | |
* Throttles a call to a method based on the time between calls. | |
* @param {Function} fn The function call to throttle. | |
* @param {Object} [context] context fn to run | |
* @param {Number} [ms] The number of milliseconds to throttle the method call. | |
* Passing a -1 will disable the throttle. Defaults to 150. | |
* @return {Function} Returns a wrapped function that calls fn throttled. | |
* @member KISSY | |
*/ |
* | |
jQuery array utils - 0.1 | |
http://code.google.com/p/jquery-utils/ | |
(c) Maxime Haineault <[email protected]> | |
http://haineault.com | |
MIT License (http://www.opensource.org/licenses/mit-license.php | |
*/ |
捕捉浏览器中的JS运行时错误,主要通过监听window.onerror来实现。但是对于不同的脚本执行方式以及不同的浏览器,能捕获到的信息会有区别。
window.onerror 讲接收3个参数:
msg
:错误描述,比如:a is not definedurl
:出错脚本所在的urllineNumber
:出错脚本的行数本文将对不同浏览器和不同的脚本执行方式进行测试,并总结这些区别。
/** | |
* @object -- game resource | |
*/ | |
KISSY.add('khc/mods/game/carnival/gameResource', function(S) { | |
var BASE_PATH = '../src/image/game/carnival/'; | |
var X_SIZE = 10; | |
var Y_SIZE = 10; | |
var carnivalCfg = [{ | |
name: 'map', |
/** | |
* @class bezier | |
*/ | |
KISSY.add('khc/lib/bezier', function(S) { | |
var TOTAL_SIMPSON_STEP = 100; | |
/** | |
* @class bezier | |
*/ |
/* | |
Copyright 2013, KISSY UI Library v1.40dev | |
MIT Licensed | |
build time: Aug 13 19:05 | |
*/ | |
/** | |
* @ignore | |
* A seed where KISSY grows up from, KISS Yeah ! | |
* @author https://github.com/kissyteam?tab=members | |
*/ |
macro varr { | |
rule {$name:ident(,)... = $val:expr(,)...} => { | |
$(var $name = $val;)... | |
} | |
} | |
varr a, b, c = 1, 2, 3 |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> | |
<title>FishEye</title> | |
<style> | |
html { |
// Domain Public by Eric Wendelin http://eriwen.com/ (2008) | |
// Luke Smith http://lucassmith.name/ (2008) | |
// Loic Dachary <[email protected]> (2008) | |
// Johan Euphrosine <[email protected]> (2008) | |
// Oyvind Sean Kinsey http://kinsey.no/blog (2010) | |
// Victor Homyakov <[email protected]> (2010) | |
/*global module, exports, define, ActiveXObject*/ | |
(function(global, factory) { | |
if (typeof exports === 'object') { | |
// Node |
/* | |
* Javascript Diff Algorithm | |
* By John Resig (http://ejohn.org/) | |
* Modified by Chu Alan "sprite" | |
* | |
* Released under the MIT license. | |
* | |
* More Info: | |
* http://ejohn.org/projects/javascript-diff-algorithm/ | |
* |