Web worker js snippet