Sha256: 1cc1e2a84c89e7b8e5f90cb11a8e25d54ac8a0bcda29367407eb7bbbb0610539
Contents?: true
Size: 1.03 KB
Versions: 33
Compression:
Stored size: 1.03 KB
Contents
/** * TODO: Ideally this would be a NodeList.prototype.forEach polyfill * This seems to fail in IE8, requires more investigation. * See: https://github.com/imagitama/nodelist-foreach-polyfill */ export function nodeListForEach (nodes, callback) { if (window.NodeList.prototype.forEach) { return nodes.forEach(callback) } for (var i = 0; i < nodes.length; i++) { callback.call(window, nodes[i], i, nodes) } } // Used to generate a unique string, allows multiple instances of the component without // Them conflicting with each other. // https://stackoverflow.com/a/8809472 export function generateUniqueID () { var d = new Date().getTime() if (typeof window.performance !== 'undefined' && typeof window.performance.now === 'function') { d += window.performance.now() // use high-precision timer if available } return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = (d + Math.random() * 16) % 16 | 0 d = Math.floor(d / 16) return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16) }) }
Version data entries
33 entries across 33 versions & 1 rubygems