Socket
Socket
Sign inDemoInstall

css-to-js-sourcemap-worker

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-to-js-sourcemap-worker

## Worker protocol


Version published
Weekly downloads
701
increased by6.86%
Maintainers
1
Weekly downloads
 
Created
Source

css-to-js-sourcemap-worker

Worker protocol

type MessageToWorker =
  | {id: "init_wasm", url: string}
  | {
      id: "add_mapped_class",
      error: ErrorLikeObject,
      className: string,
      stackIndex: number
    }
  | {id: "set_render_interval", interval: number}
  | {id: "clear_render_interval"}
  | {id: "schedule_render"}
  | {id: "invalidate"};

type MessageFromWorker =
  {id: "render_css", css: string};

type ErrorLikeObject = {
  stack?: string,
  stacktrace?: string,
  message?: string
};

Sample usage

const worker = new Worker("https://unpkg.com/css-to-js-sourcemap-worker@1.0.0/worker.js");

worker.onmessage = msg => {
  if (msg.id === "render_css" && msg.css) {
    const style = document.createElement("style");
    style.appendChild(document.createTextNode(msg.css));
    document.head.appendChild(style);
  }
};

const {stack, stacktrace, message} = new Error("create stack trace");

worker.postMessage({
  id: "init_wasm",
  url: "https://unpkg.com/source-map@0.7.3/lib/mappings.wasm",
});
worker.postMessage({
  id: "add_mapped_class",
  error: {stack, stacktrace, message},
  className: "__debug-1",
  stackIndex: 0,
});
worker.postMessage({
  id: "set_render_interval",
  interval: 120,
});

FAQs

Package last updated on 06 Jun 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc