Skip to content

Commit 383e038

Browse files
committed
精简代码
1 parent 7cb0b62 commit 383e038

File tree

8 files changed

+99
-32
lines changed

8 files changed

+99
-32
lines changed

heatmap.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sensorsdata.amd.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sensorsdata.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/heatmap.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9670,6 +9670,73 @@ var heatmap = {
96709670
window.sa_jssdk_heatmap_render = function(se,data,type,url){
96719671
sd = se;
96729672
_ = sd._;
9673+
_.now = Date.now || function() {
9674+
return new Date().getTime();
9675+
};
9676+
9677+
_.throttle = function(func, wait, options) {
9678+
var context, args, result;
9679+
var timeout = null;
9680+
var previous = 0;
9681+
if (!options) options = {};
9682+
var later = function() {
9683+
previous = options.leading === false ? 0 : _.now();
9684+
timeout = null;
9685+
result = func.apply(context, args);
9686+
if (!timeout) context = args = null;
9687+
};
9688+
return function() {
9689+
var now = _.now();
9690+
if (!previous && options.leading === false) previous = now;
9691+
var remaining = wait - (now - previous);
9692+
context = this;
9693+
args = arguments;
9694+
if (remaining <= 0 || remaining > wait) {
9695+
if (timeout) {
9696+
clearTimeout(timeout);
9697+
timeout = null;
9698+
}
9699+
previous = now;
9700+
result = func.apply(context, args);
9701+
if (!timeout) context = args = null;
9702+
} else if (!timeout && options.trailing !== false) {
9703+
timeout = setTimeout(later, remaining);
9704+
}
9705+
return result;
9706+
};
9707+
};
9708+
_.bindReady = function(fn,win) {
9709+
win = win || window;
9710+
var done = false,
9711+
top = true,
9712+
doc = win.document,
9713+
root = doc.documentElement,
9714+
modern = doc.addEventListener,
9715+
add = modern ? 'addEventListener' : 'attachEvent',
9716+
rem = modern ? 'removeEventListener' : 'detachEvent',
9717+
pre = modern ? '' : 'on',
9718+
init = function(e) {
9719+
if (e.type == 'readystatechange' && doc.readyState != 'complete') return;
9720+
(e.type == 'load' ? win : doc)[rem](pre + e.type, init, false);
9721+
if (!done && (done = true)) fn.call(win, e.type || e);
9722+
},
9723+
poll = function() {
9724+
try { root.doScroll('left'); } catch(e) { setTimeout(poll, 50); return; }
9725+
init('poll');
9726+
};
9727+
9728+
if (doc.readyState == 'complete') fn.call(win, 'lazy');
9729+
else {
9730+
if (!modern && root.doScroll) {
9731+
try { top = !win.frameElement; } catch(e) { }
9732+
if (top) poll();
9733+
}
9734+
doc[add](pre + 'DOMContentLoaded', init, false);
9735+
doc[add](pre + 'readystatechange', init, false);
9736+
win[add](pre + 'load', init, false);
9737+
}
9738+
9739+
};
96739740
heatmap.prepare(data,type,url);
96749741
};
96759742

src/sdk.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ _.encodeDates = function(obj) {
255255
return obj;
256256
};
257257

258-
_.now = Date.now || function() {
258+
/* _.now = Date.now || function() {
259259
return new Date().getTime();
260260
};
261261
@@ -289,7 +289,7 @@ _.throttle = function(func, wait, options) {
289289
}
290290
return result;
291291
};
292-
};
292+
}; */
293293

294294
_.hashCode = function(str){
295295
if(typeof str !== 'string'){
@@ -703,7 +703,7 @@ _.getDomainByHost = function(url) {
703703
}
704704
*/
705705

706-
_.draggable = function(elementToDrag, event) {
706+
/* _.draggable = function(elementToDrag, event) {
707707
function getScrollOffsets() {
708708
var w = document;
709709
if (w.pageXOffset != null) {
@@ -760,10 +760,10 @@ _.draggable = function(elementToDrag, event) {
760760
if (e.stopPropagation) e.stopPropagation();
761761
else e.cancelBubble = true;
762762
}
763-
}
763+
} */
764764

765765
// 是否有标准的浏览器环境,如果不是发送$errorEnviroment:{$errorReson:'没有window'}
766-
_.hasStandardBrowserEnviroment = function() {
766+
/* _.hasStandardBrowserEnviroment = function() {
767767
if (!window) {
768768
return 'window';
769769
}
@@ -777,9 +777,9 @@ _.hasStandardBrowserEnviroment = function() {
777777
return 'screen';
778778
}
779779
780-
};
780+
}; */
781781

782-
_.bindReady = function(fn,win) {
782+
/* _.bindReady = function(fn,win) {
783783
win = win || window;
784784
var done = false,
785785
top = true,
@@ -810,7 +810,7 @@ _.bindReady = function(fn,win) {
810810
win[add](pre + 'load', init, false);
811811
}
812812
813-
};
813+
}; */
814814

815815

816816
_.addEvent = function() {

src/sensorsdata.full.amd.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ var ObjProto = Object.prototype;
153153
var slice = ArrayProto.slice;
154154
var toString = ObjProto.toString;
155155
var hasOwnProperty = ObjProto.hasOwnProperty;
156-
var LIB_VERSION = '1.10.7';
156+
var LIB_VERSION = '1.10.8';
157157

158158
sd.lib_version = LIB_VERSION;
159159

@@ -404,7 +404,7 @@ _.encodeDates = function(obj) {
404404
return obj;
405405
};
406406

407-
_.now = Date.now || function() {
407+
/* _.now = Date.now || function() {
408408
return new Date().getTime();
409409
};
410410
@@ -438,7 +438,7 @@ _.throttle = function(func, wait, options) {
438438
}
439439
return result;
440440
};
441-
};
441+
}; */
442442

443443
_.hashCode = function(str){
444444
if(typeof str !== 'string'){
@@ -852,7 +852,7 @@ _.getDomainByHost = function(url) {
852852
}
853853
*/
854854

855-
_.draggable = function(elementToDrag, event) {
855+
/* _.draggable = function(elementToDrag, event) {
856856
function getScrollOffsets() {
857857
var w = document;
858858
if (w.pageXOffset != null) {
@@ -909,10 +909,10 @@ _.draggable = function(elementToDrag, event) {
909909
if (e.stopPropagation) e.stopPropagation();
910910
else e.cancelBubble = true;
911911
}
912-
}
912+
} */
913913

914914
// 是否有标准的浏览器环境,如果不是发送$errorEnviroment:{$errorReson:'没有window'}
915-
_.hasStandardBrowserEnviroment = function() {
915+
/* _.hasStandardBrowserEnviroment = function() {
916916
if (!window) {
917917
return 'window';
918918
}
@@ -926,9 +926,9 @@ _.hasStandardBrowserEnviroment = function() {
926926
return 'screen';
927927
}
928928
929-
};
929+
}; */
930930

931-
_.bindReady = function(fn,win) {
931+
/* _.bindReady = function(fn,win) {
932932
win = win || window;
933933
var done = false,
934934
top = true,
@@ -959,7 +959,7 @@ _.bindReady = function(fn,win) {
959959
win[add](pre + 'load', init, false);
960960
}
961961
962-
};
962+
}; */
963963

964964

965965
_.addEvent = function() {

src/sensorsdata.full.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ var ObjProto = Object.prototype;
150150
var slice = ArrayProto.slice;
151151
var toString = ObjProto.toString;
152152
var hasOwnProperty = ObjProto.hasOwnProperty;
153-
var LIB_VERSION = '1.10.7';
153+
var LIB_VERSION = '1.10.8';
154154

155155
sd.lib_version = LIB_VERSION;
156156

@@ -401,7 +401,7 @@ _.encodeDates = function(obj) {
401401
return obj;
402402
};
403403

404-
_.now = Date.now || function() {
404+
/* _.now = Date.now || function() {
405405
return new Date().getTime();
406406
};
407407
@@ -435,7 +435,7 @@ _.throttle = function(func, wait, options) {
435435
}
436436
return result;
437437
};
438-
};
438+
}; */
439439

440440
_.hashCode = function(str){
441441
if(typeof str !== 'string'){
@@ -849,7 +849,7 @@ _.getDomainByHost = function(url) {
849849
}
850850
*/
851851

852-
_.draggable = function(elementToDrag, event) {
852+
/* _.draggable = function(elementToDrag, event) {
853853
function getScrollOffsets() {
854854
var w = document;
855855
if (w.pageXOffset != null) {
@@ -906,10 +906,10 @@ _.draggable = function(elementToDrag, event) {
906906
if (e.stopPropagation) e.stopPropagation();
907907
else e.cancelBubble = true;
908908
}
909-
}
909+
} */
910910

911911
// 是否有标准的浏览器环境,如果不是发送$errorEnviroment:{$errorReson:'没有window'}
912-
_.hasStandardBrowserEnviroment = function() {
912+
/* _.hasStandardBrowserEnviroment = function() {
913913
if (!window) {
914914
return 'window';
915915
}
@@ -923,9 +923,9 @@ _.hasStandardBrowserEnviroment = function() {
923923
return 'screen';
924924
}
925925
926-
};
926+
}; */
927927

928-
_.bindReady = function(fn,win) {
928+
/* _.bindReady = function(fn,win) {
929929
win = win || window;
930930
var done = false,
931931
top = true,
@@ -956,7 +956,7 @@ _.bindReady = function(fn,win) {
956956
win[add](pre + 'load', init, false);
957957
}
958958
959-
};
959+
}; */
960960

961961

962962
_.addEvent = function() {

version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
var sensorsdata_js_sdk_latest_version = '1.10.7';
1+
var sensorsdata_js_sdk_latest_version = '1.10.8';

0 commit comments

Comments
 (0)