Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// If there's no console then don't try to output messages, but they will
// still be stored in history.
if (!window.console) {
return;
}
// Was setting these once outside of this function, but containing them
// in the function makes it easier to test cases where console doesn't exist
// when the module is executed.
let fn = window.console[type];
if (!fn && type === 'debug') {
// Certain browsers don't have support for console.debug. For those, we
// should default to the closest comparable log.
fn = window.console.info || window.console.log;
}
// Bail out if there's no console or if this type is not allowed by the
// current logging level.
if (!fn || !lvl || !lvlRegExp.test(type)) {
return;
}
// IEs previous to 11 log objects uselessly as "[object Object]"; so, JSONify
// objects and arrays for those less-capable browsers.
if (stringify) {
args = args.map(a => {
if (isObject(a) || Array.isArray(a)) {
try {
return JSON.stringify(a);
} catch (x) {
// If there's no console then don't try to output messages, but they will
// still be stored in history.
if (!window.console) {
return;
}
// Was setting these once outside of this function, but containing them
// in the function makes it easier to test cases where console doesn't exist
// when the module is executed.
let fn = window.console[type];
if (!fn && type === 'debug') {
// Certain browsers don't have support for console.debug. For those, we
// should default to the closest comparable log.
fn = window.console.info || window.console.log;
}
// Bail out if there's no console or if this type is not allowed by the
// current logging level.
if (!fn || !lvl || !lvlRegExp.test(type)) {
return;
}
fn[Array.isArray(args) ? 'apply' : 'call'](window.console, args);
};
// Add the type to the front of the message when it's not "log".
args.unshift(type.toUpperCase() + ':');
}
// Add a clone of the args at this point to history.
if (history) {
history.push([].concat(args));
}
// Add console prefix after adding to history.
args.unshift('VIDEOJS:');
// If there's no console then don't try to output messages, but they will
// still be stored in history.
if (!window.console) {
return;
}
// Was setting these once outside of this function, but containing them
// in the function makes it easier to test cases where console doesn't exist
// when the module is executed.
let fn = window.console[type];
if (!fn && type === 'debug') {
// Certain browsers don't have support for console.debug. For those, we
// should default to the closest comparable log.
fn = window.console.info || window.console.log;
}
// Bail out if there's no console or if this type is not allowed by the
// current logging level.
const { history, account } = this.props;
if (!account) {
return;
}
try {
const txHash = await Token.getToken(tokenAddress).claimAs(
authMessage,
account
);
// @ts-ignore
window.console.log(
`Claimed VITA to ${authMessage.address} at action hash: ${txHash}`
);
history.push(`/wallet/smart-contract/interact/${txHash}`);
} catch (e) {
window.console.log(e);
notification.error({
message: `Failed to claim: ${e}`
});
}
};
public placeBid = async (amount: string) => {
const { account, history, bidContractAddress } = this.props;
if (!account) {
return;
}
try {
const txHash = await Token.getBiddingToken(bidContractAddress).bid(
account,
amount
);
// @ts-ignore
window.console.log(`Place bid ${amount} IOTX at action hash: ${txHash}`);
history.push(`/wallet/smart-contract/interact/${txHash}`);
} catch (e) {
notification.error({
message: `Failed to bid: ${e}`
});
}
};
parser.onparsingerror = function(error) {
errors.push(error);
};
parser.onflush = function() {
track.trigger({
type: 'loadeddata',
target: track
});
};
parser.parse(srcContent);
if (errors.length > 0) {
if (window.console && window.console.groupCollapsed) {
window.console.groupCollapsed(`Text Track parsing errors for ${track.src}`);
}
errors.forEach((error) => log.error(error));
if (window.console && window.console.groupEnd) {
window.console.groupEnd();
}
}
parser.flush();
};
this.ws.onopen = (): void => {
window.console.log("[antenna-ws] connected");
};
this.ws.onclose = (): void => {