Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
foresight
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
libraries
foresight
Commits
00b0cb82
Commit
00b0cb82
authored
Aug 02, 2018
by
James Ooi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix autotrack
parent
3e0e91b8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
13 deletions
+18
-13
foresight.js
dist/foresight.js
+9
-7
foresight.min.js
dist/foresight.min.js
+0
-0
foresight.ts
src/foresight.ts
+9
-6
No files found.
dist/foresight.js
View file @
00b0cb82
...
...
@@ -153,11 +153,15 @@ var Foresight = /** @class */ (function () {
});
},
this
.
options
.
observerOptions
);
// Start tracking
window
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
if
(
!
_this
.
options
.
defer
)
{
_this
.
start
();
if
(
!
this
.
options
.
defer
)
{
var
domContentLoaded
=
document
.
readyState
===
'complete'
||
document
.
readyState
===
'interactive'
;
if
(
domContentLoaded
)
{
this
.
start
();
}
else
{
window
.
addEventListener
(
'DOMContentLoaded'
,
function
()
{
return
_this
.
start
();
});
}
}
});
}
/**
* Start tracking all elements with tracking attributes for events.
...
...
@@ -257,9 +261,7 @@ var Foresight = /** @class */ (function () {
Foresight
.
prototype
.
_trackClicks
=
function
(
element
)
{
var
_this
=
this
;
// Define listen fucntion
var
listener
=
function
(
e
)
{
_this
.
_onTrackedClick
(
element
,
e
);
};
var
listener
=
function
(
e
)
{
return
_this
.
_onTrackedClick
(
element
,
e
);
};
element
.
addEventListener
(
'click'
,
listener
);
element
.
addEventListener
(
'auxclick'
,
listener
);
return
function
()
{
...
...
dist/foresight.min.js
View file @
00b0cb82
This diff is collapsed.
Click to expand it.
src/foresight.ts
View file @
00b0cb82
...
...
@@ -97,9 +97,14 @@ class Foresight {
},
this
.
options
.
observerOptions
);
// Start tracking
window
.
addEventListener
(
'DOMContentLoaded'
,
()
=>
{
if
(
!
this
.
options
.
defer
)
{
this
.
start
();
}
});
if
(
!
this
.
options
.
defer
)
{
const
domContentLoaded
=
document
.
readyState
===
'complete'
||
document
.
readyState
===
'interactive'
;
if
(
domContentLoaded
)
{
this
.
start
()
}
else
{
window
.
addEventListener
(
'DOMContentLoaded'
,
()
=>
this
.
start
());
}
}
}
/**
...
...
@@ -215,9 +220,7 @@ class Foresight {
*/
private
_trackClicks
(
element
:
Element
):
Function
{
// Define listen fucntion
const
listener
=
(
e
)
=>
{
this
.
_onTrackedClick
(
element
,
e
);
};
const
listener
=
(
e
)
=>
this
.
_onTrackedClick
(
element
,
e
);
element
.
addEventListener
(
'click'
,
listener
);
element
.
addEventListener
(
'auxclick'
,
listener
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment