function sendSubscriptionToServer(endpoint, key, auth) { const encodedKey = btoa(String.fromCharCode.apply(null, new Uint8Array(key))); const encodedAuth = btoa(String.fromCharCode.apply(null, new Uint8Array(auth))); fetch(schnack_host + '/subscribe', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ publicKey: encodedKey, auth: encodedAuth, endpoint }) }).then(res => { // eslint-disable-next-line no-console console.log('Subscribed successfully! ' + JSON.stringify(res)); }); }
function debug(a, b, c, d) { var arr = ['\x1b[36m[apicache]\x1b[0m', a, b, c, d].filter(function (arg) { return arg !== undefined }) var debugEnv = process.env.DEBUG && process.env.DEBUG.split(',').indexOf('apicache') !== -1 return (globalOptions.debug || debugEnv) && console.log.apply(null, arr) }
function print(...msg) { if (outputProcess) { msg.unshift(outputProcess); } if (!newline) { console.log(); newline = true; } console.log.apply(this, msg); }
$export($export.P + $export.F * (NEGATIVE_ZERO || !_dereq_(105)($native)), 'Array', { // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex]) indexOf: function indexOf(searchElement /* , fromIndex = 0 */) { return NEGATIVE_ZERO // convert -0 to +0 ? $native.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments[1]); } });
/** * Flatten the given arrays into a new array * * @param {Array<Array<T>>} arrays * @returns {Array<T>} * @template T */ function flatten(arrays) { return [].concat.apply([], arrays) }
const getMax = arr => { if (arr.size === 0) { return -1; } return Math.max.apply(Math, arr.toJS().map(o => o._temp__id)); }
// raise a console warning function warn() { if ( ! I18N.throwErrors ) { return; } if ( 'undefined' !== typeof window && window.console && window.console.warn ) { window.console.warn.apply( window.console, arguments ); } }
export function formatString() { var args = [].slice.apply( arguments ); var str = args.shift(); return str.replace( /{(\d+)}/g, function ( match, number ) { return typeof args[ number ] != 'undefined' ? args[ number ] : match; } ); }
function decodeClientPayload(payload) { /* Special function which Client using to "encode" clients JSON payload */ return JSON.parse(String.fromCharCode.apply(null, payload)); }
allPropertiesOf(obj) { const props = []; do { props.push.apply(props, Object.getOwnPropertyNames(obj)); } while (obj = Object.getPrototypeOf(obj)); return props; }
function has(object, name) { return object != null && apply(hasOwnProperty, object, [name]) }
const getMax = arr => { if (arr.size === 0) { return -1; } return Math.max.apply(Math, arr.toJS().map(o => o._temp__id)); }
function removeSubscriptionFromServer(endpoint) { const encodedKey = btoa(String.fromCharCode.apply(null, new Uint8Array(key))); const encodedAuth = btoa(String.fromCharCode.apply(null, new Uint8Array(auth))); fetch(schnack_host + '/unsubscribe', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ publicKey: encodedKey, auth: encodedAuth, endpoint }) }).then(res => { // eslint-disable-next-line no-console console.log('Unsubscribed successfully! ' + JSON.stringify(res)); }); }