Skip to content

Instantly share code, notes, and snippets.

View gauthamchandra's full-sized avatar

Gautham Chandra gauthamchandra

View GitHub Profile
@gauthamchandra
gauthamchandra / resize_observer.js
Last active January 10, 2019 22:29
ResizeObserver Polyfill (using requestAnimationFrame)
const requestAnimationFrame = window.requestAnimationFrame ||
window.webkitRequestAnimationFrame ||
window.mozRequestAnimationFrame;
const cancelAnimationFrame = window.cancelAnimationFrame ||
window.webkitCancelAnimationFrame ||
window.mozCancelAnimationFrame;
export default class ResizeObserver {
constructor(domElement, callback) {
@gauthamchandra
gauthamchandra / backbone-jsdoc-example.js
Last active August 30, 2022 13:35
Writing Proper JSDocs for Backbone Objects (Specifically Tying its properties as instance members of a
//The @name is needed to specify a namespace. This is used in conjunction with the @lends annotation to
//tie the object properties to the class. Adding the @class annotation at the top finally makes sure its grouped as 'Classes'
//and not 'Namespaces'
//NOTE: The @lends is used with the Class's prototype so that the properties show up in an IDE's intellisense
//for all instances of the TeaCollection as well as instances of any object that inherits from TeaCollection
//NOTE 2: You must use the @lends annotation before the object literal definition for the JSDocs to be generated correctly
/**