mirror of
https://github.com/getredash/redash.git
synced 2026-03-22 10:00:17 -04:00
* Add non Angular version of Events. * Add event tracking for autocomplete toggle * Fix lint error in QueryEditor
26 lines
594 B
JavaScript
26 lines
594 B
JavaScript
import { debounce } from 'lodash';
|
|
import { $http } from '@/services/http';
|
|
|
|
let events = [];
|
|
|
|
const post = debounce(() => {
|
|
const eventsToSend = events;
|
|
events = [];
|
|
|
|
$http.post('api/events', eventsToSend);
|
|
}, 1000);
|
|
|
|
export default function recordEvent(action, objectType, objectId, additionalProperties) {
|
|
const event = {
|
|
action,
|
|
object_type: objectType,
|
|
object_id: objectId,
|
|
timestamp: Date.now() / 1000.0,
|
|
screen_resolution: `${window.screen.width}x${window.screen.height}`,
|
|
};
|
|
Object.assign(event, additionalProperties);
|
|
events.push(event);
|
|
|
|
post();
|
|
}
|