Commit Graph

109 Commits

Author SHA1 Message Date
Yanzhen Yu
533885a707 export timer to public API 2018-12-26 20:58:14 +08:00
Yanzhen Yu
05b42322d7 emit speed with skip event 2018-12-26 18:14:47 +08:00
Yanzhen Yu
aaa8bb9e94 add skipInactive option
Skip inactive time is an important and useful feature. We consider
user interaction events as active, and check next user interaction
event after apply incremental snapshot.
If next user interaction event has a time gap larger than the
threshold, we will set a dynamic speed value which will skip the
inactive time interval in about 5 seconds.
2018-12-26 18:05:55 +08:00
Yanzhen Yu
db86ca13fa fix some safari's scroll related issue 2018-12-25 16:30:36 +08:00
Yanzhen Yu
b7cf1548a3 update rrweb-snapshot 2018-12-21 22:33:38 +08:00
Yanzhen Yu
f1fbb9d07e safely scroll element since its last event may fired after being removed 2018-12-21 14:31:19 +08:00
Yanzhen Yu
b3412b1d46 fix resolve missing node when target has both previous and next missing node 2018-12-20 17:29:03 +08:00
Yanzhen Yu
097321619c check is dropped and is removed by ancestors instead of only check parent 2018-12-20 15:29:02 +08:00
Yanzhen Yu
661fa6c7eb Add missingNodeRetryMap
Use a global missing node retry map to handle missing node that
has not been resolved in the same round.
2018-12-20 14:46:58 +08:00
Yanzhen Yu
df1b3d50b7 fix resume to move baseline time by time offset 2018-12-14 14:11:49 +08:00
Yanzhen Yu
a5d0eaa451 only add click animation when cast is not sync 2018-12-14 13:52:47 +08:00
Yanzhen Yu
b9e4117810 fix timer requestAnimationFrame call may not stop after clear
Before this patch, the checker in the timer will stop only when
actions array is empty.
When we call play more than once, it will clear the timer first,
then  push filtered new actions and start the timer again. If
all of this happened in a frame, the checker which should be
cleared may found actions array is not empty and keep check.
So this patch we use timer.raf to hold raf's handle and cancel
it when clear was called.
2018-12-14 13:37:00 +08:00
Yanzhen Yu
6e41bc3bfa add some unit tests to replayer 2018-12-14 13:35:10 +08:00
Yanzhen Yu
c5998d70a3 prevent scroll when dispatch focus 2018-12-07 17:16:01 +08:00
Yanzhen Yu
fda6d1c873 emit pause and resume events 2018-12-06 18:04:40 +08:00
Yanzhen Yu
9d627d1912 fix mouse move time offset may be mutated multiple times 2018-12-06 17:29:19 +08:00
Yanzhen Yu
2c9db926c0 resolve #1 add ignore and block strategy for privacy purpose 2018-12-02 23:23:21 +08:00
Yanzhen Yu
78967192fc return stopper function as the result of record 2018-12-02 22:37:28 +08:00
Yanzhen Yu
b7e7f12d32 new sandbox strategy
In this commit we switched the sandbox strategy to use iframe's
sandbox attribute. Indeed we do not need delegate event anymore,
but need to add some styles into the iframe.
The details were documented in the sandbox part of internal design.
2018-11-27 17:04:30 +08:00
Yanzhen Yu
2c0a0edf36 basic impl of wait for stylesheet loaded 2018-11-26 18:19:07 +08:00
Yanzhen Yu
5b61d98f8b check interaction target before apply 2018-11-23 20:02:18 +08:00
Yanzhen Yu
86286ddb94 check parentNode when calling insertBefore
When add new nodes, we may use insertBefore API to insert node before
its next sibling. But the sibling may not in the DOM tree at that
moment if it was in the missing node map.
2018-11-23 18:08:37 +08:00
Yanzhen Yu
eab30bd274 improve prevent default event when replay 2018-11-23 18:06:19 +08:00
Yanzhen Yu
181c8e1d5d fix timer clear method with do not reassign actions pointer 2018-11-23 14:22:18 +08:00
edwardwu
6382315d43 resolve #4 Improve timer's performance by storing all callbacks in an array (#5) 2018-11-16 21:53:59 +08:00
Yanzhen Yu
7845e74ae5 extract css by rollup plugin 2018-11-13 23:04:43 +08:00
Yanzhen Yu
69c6d96455 update dependencies
In this commit, we updated rrweb-snapshot to 0.6.0 which including
a breaking change in data structure.
2018-11-13 16:21:05 +08:00
Yanzhen Yu
fc4804c8bc prevent form and a tag default behaviour 2018-11-06 14:23:55 +08:00
Yanzhen Yu
4709c720cd also resolve missing previous node 2018-11-05 13:20:42 +08:00
Yanzhen Yu
0fb8fc4e0b Fix add node logic with missingNextNodeMap
This patch include a breaking change to the recorder's event data.

We used to consider mirror.getId will always return the id of the
target node because we keep serialize every node. But if we call
mirror.getId before serialization then bug happened. This could
happen when we get nextId of newly added nodes if its next sibling
was also newly added.
So we have to return -1 as the id of node which was not serialized
and when we building added nodes in the replayer we should handle
this.

For example, nodes el1, el2 were added together and el1's nextId
will be -1 since el2 was not serialized at that moment. Now we
call el1 as a 'missing next node' and not append it into the DOM
tree after building, instead we store it in a missingNextNodeMap.
After a added node in the same mutation was successfully appened
we will check whether it has a previous id and the id was pointed
to some nodes in the map, if so, we will insert that node before
it and delete the node from map.
2018-11-02 19:23:03 +08:00
Yanzhen Yu
618f9aed19 fix the add node condition 2018-11-02 10:31:26 +08:00
Yanzhen Yu
a89e71e5e7 fix order of continuous append 2018-11-01 17:16:54 +08:00
Yanzhen Yu
e9add18029 Implement #2: simulate hover event 2018-11-01 13:31:09 +08:00
Yanzhen Yu
8f22a1b92f implement pause which has a better performance than play at some time offset 2018-10-31 16:43:49 +08:00
Yanzhen Yu
cff1617959 fix mutation filter in recorder and change the order of apply mutations in replayer
This change include two critical fix for both recorder and replayer.

In the recorder, previously we filter text and attribute mutations by check its target id,
but this was a wrong approach because removed node also has id at the callback moment.
We corrected this by checking whether the mirror map still has the target id in its keys.

In the replayer side, the issue was we got exceptions when calling insertBefore which says
the ref node was not the child node of the caller node. This will happen when the previous
or next sibling has been removed in the same callback but the previousId or nextId was
recorded.
After apply remove node mutations before add node mutations, we can make sure the removed
siblings will not exist in the mirror map when apply add node mutations. When we get node
from mirror map with an removed id, we will get null and pass it to insertBefore which
is valid.
As a side note, this apply order is safe because we ensured all the remove node mutations
do not include removing newly added nodes in the same callback.
2018-10-31 12:06:41 +08:00
Yanzhen Yu
8acf670a99 add a has method to mirror for checking whether an id is in the map 2018-10-31 12:06:32 +08:00
Yanzhen Yu
7b9e57bd6c filter text and attributes mutations which target tot a removed node 2018-10-23 11:48:48 +08:00
Yanzhen Yu
68949a08c3 check added nodes from removed nodes and dropped nodes 2018-10-23 11:28:15 +08:00
Yanzhen Yu
d588f738b8 rewrite mutation observer handler with lazy child list calculation 2018-10-22 23:08:05 +08:00
Yanzhen Yu
a88a79d821 add meta event and fix childList observer, also update related replayer 2018-10-22 10:48:56 +08:00
Yanzhen Yu
6c8cf5c379 implemented the play any offset feature 2018-10-18 16:24:01 +08:00
Yanzhen Yu
8186f05e1c export more props of replayer to the UI 2018-10-17 17:47:38 +08:00
Yanzhen Yu
d827fdc947 impl dynamic config and pause. Bump 0.3.0 2018-10-16 15:31:56 +08:00
Yanzhen Yu
49cd7b4db3 align id map by skip extra added nodes 2018-10-16 15:29:52 +08:00
Yanzhen Yu
a98df40c93 update id map when DOM changed and handle element scroll event 2018-10-15 19:28:36 +08:00
Yanzhen Yu
2816726e23 impl replay the mutations and mouse interactions 2018-10-15 12:37:47 +08:00
Yanzhen Yu
95713f1ea7 apply viewport resize and input event changes 2018-10-12 16:04:07 +08:00
Yanzhen Yu
f4bf94aa2d use raf to impl a more accurate timer and replay events async 2018-10-12 14:30:44 +08:00
Yanzhen Yu
e93fd177be import snapshot rebuilder into replayer 2018-10-12 13:33:53 +08:00
Yanzhen Yu
85a56d2047 fix scroll value and record viewport when loaded 2018-10-12 13:08:03 +08:00