impl #23 add custom privacy selectors

This commit is contained in:
Yanzhen Yu
2019-04-02 00:25:08 +08:00
parent c7fc6900d4
commit c04e4bf0a5
7 changed files with 60 additions and 32 deletions

View File

@@ -18,7 +18,13 @@ function wrapEvent(e: event): eventWithTime {
}
function record(options: recordOptions = {}): listenerHandler | undefined {
const { emit, checkoutEveryNms, checkoutEveryNth } = options;
const {
emit,
checkoutEveryNms,
checkoutEveryNth,
blockClass = 'rr-block',
ignoreClass = 'rr-ignore',
} = options;
// runtime checks for user options
if (!emit) {
throw new Error('emit function is required');
@@ -56,7 +62,7 @@ function record(options: recordOptions = {}): listenerHandler | undefined {
}),
isCheckout,
);
const [node, idNodeMap] = snapshot(document);
const [node, idNodeMap] = snapshot(document, blockClass);
if (!node) {
return console.warn('Failed to snapshot the document');
}
@@ -152,6 +158,8 @@ function record(options: recordOptions = {}): listenerHandler | undefined {
},
}),
),
blockClass,
ignoreClass,
}),
);
};