Skip to content

Instantly share code, notes, and snippets.

View medynski's full-sized avatar
🎱

Wojciech Medyński medynski

🎱
View GitHub Profile
@medynski
medynski / ext.js
Last active November 9, 2016 20:18
class Extension {
constructor(api, component, element) {
this.$api = api;
this.$component = component;
this.$el = element;
this.id = api.store.currentConversation().id;
this.keyboardListener = api.dom.onTextareaKeyboardEvent(this.onKeyboardEvent.bind(this));
api.common.onCurrentConversationChanged(event => {
@medynski
medynski / fpsMeter.js
Last active July 30, 2024 17:47
JavaScript FPS meter - Calculating frames per second
function fpsMeter() {
let prevTime = Date.now(),
frames = 0;
requestAnimationFrame(function loop() {
const time = Date.now();
frames++;
if (time > prevTime + 1000) {
let fps = Math.round( ( frames * 1000 ) / ( time - prevTime ) );
prevTime = time;