Skip to content

Instantly share code, notes, and snippets.

View 6174's full-sized avatar

Marc Chen 6174

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title>DEMO</title>
<script type="text/javascript" src="simple_javascript_templating.js"></script>
</head>
<body>
<table id="table_1">
</table>
<script type="text/html" id="tmpl_1">
@6174
6174 / jsDump.js
Created January 3, 2014 12:03
jsDump
/**
* jsDump
* Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
* Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
* Date: 5/15/2008
* @projectDescription Advanced and extensible data dumping for Javascript.
* @version 1.0.0
* @author Ariel Flesler
* @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
*/
@6174
6174 / diff.js
Created January 3, 2014 11:05
diff.js
/*
* 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/
*
@6174
6174 / github_stacktrace.js
Last active April 26, 2024 10:20
stackTracejs
// 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
@6174
6174 / fishEye.html
Last active December 28, 2015 07:19
fisheye
<!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 {
@6174
6174 / hello-sweet.js
Created November 13, 2013 03:18
sweet
macro varr {
rule {$name:ident(,)... = $val:expr(,)...} => {
$(var $name = $val;)...
}
}
varr a, b, c = 1, 2, 3
@6174
6174 / seed.js
Created October 18, 2013 02:08
kissy seed.js
/*
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
*/
@6174
6174 / bezier.js
Last active December 24, 2015 03:29
javascript matrix vector bezier***
/**
* @class bezier
*/
KISSY.add('khc/lib/bezier', function(S) {
var TOTAL_SIMPSON_STEP = 100;
/**
* @class bezier
*/
@6174
6174 / resourDef.js
Last active December 23, 2015 23:39
resource manager
/**
* @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',

捕捉浏览器中的JS运行时错误,主要通过监听window.onerror来实现。但是对于不同的脚本执行方式以及不同的浏览器,能捕获到的信息会有区别。

window.onerror 讲接收3个参数:

  • msg:错误描述,比如:a is not defined
  • url:出错脚本所在的url
  • lineNumber:出错脚本的行数

本文将对不同浏览器和不同的脚本执行方式进行测试,并总结这些区别。