Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from "react";
import TimeSync from "time-sync";
export const TIMESYNC_PROP = "$$_TIME_SYNC_HIDDEN_$$";
export interface TimeSyncContext {
getCurrentTime: typeof TimeSync.getCurrentTime;
getTimeLeft: typeof TimeSync.getTimeLeft;
addTimer: typeof TimeSync.prototype.addTimer;
createCountdown: typeof TimeSync.prototype.createCountdown;
}
const timeSync = new TimeSync();
export default React.createContext({
getCurrentTime: TimeSync.getCurrentTime,
getTimeLeft: TimeSync.getTimeLeft,
addTimer: timeSync.addTimer,
createCountdown: timeSync.createCountdown
});
public constructor(props: TimeProviderProps) {
super(props);
const timeSync = props.timeSync || new TimeSync();
this.state = {
timeSync,
customTimeSync: !!props.timeSync,
timeContext: {
getCurrentTime: TimeSync.getCurrentTime,
getTimeLeft: TimeSync.getTimeLeft,
addTimer: timeSync.addTimer,
createCountdown: timeSync.createCountdown
}
};
}
public constructor(props: TimeProviderProps) {
super(props);
const timeSync = props.timeSync || new TimeSync();
this.state = {
timeSync,
customTimeSync: !!props.timeSync,
timeContext: {
getCurrentTime: TimeSync.getCurrentTime,
getTimeLeft: TimeSync.getTimeLeft,
addTimer: timeSync.addTimer,
createCountdown: timeSync.createCountdown
}
};
}
import React from "react";
import TimeSync from "time-sync";
export const TIMESYNC_PROP = "$$_TIME_SYNC_HIDDEN_$$";
export interface TimeSyncContext {
getCurrentTime: typeof TimeSync.getCurrentTime;
getTimeLeft: typeof TimeSync.getTimeLeft;
addTimer: typeof TimeSync.prototype.addTimer;
createCountdown: typeof TimeSync.prototype.createCountdown;
}
const timeSync = new TimeSync();
export default React.createContext({
getCurrentTime: TimeSync.getCurrentTime,
getTimeLeft: TimeSync.getTimeLeft,
addTimer: timeSync.addTimer,
createCountdown: timeSync.createCountdown
});
import TimeSync from "time-sync";
export const TIMESYNC_PROP = "$$_TIME_SYNC_HIDDEN_$$";
export interface TimeSyncContext {
getCurrentTime: typeof TimeSync.getCurrentTime;
getTimeLeft: typeof TimeSync.getTimeLeft;
addTimer: typeof TimeSync.prototype.addTimer;
createCountdown: typeof TimeSync.prototype.createCountdown;
}
const timeSync = new TimeSync();
export default React.createContext({
getCurrentTime: TimeSync.getCurrentTime,
getTimeLeft: TimeSync.getTimeLeft,
addTimer: timeSync.addTimer,
createCountdown: timeSync.createCountdown
});
public constructor(props: TimeProviderProps) {
super(props);
const timeSync = props.timeSync || new TimeSync();
this.state = {
timeSync,
customTimeSync: !!props.timeSync,
timeContext: {
getCurrentTime: TimeSync.getCurrentTime,
getTimeLeft: TimeSync.getTimeLeft,
addTimer: timeSync.addTimer,
createCountdown: timeSync.createCountdown
}
};
}