Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@procore/cdn

Package Overview
Dependencies
Maintainers
18
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@procore/cdn

Resolve the procore CDN

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
18
Created
Source

Resolve Procore CDN

Motivation

Browsers only allow 6 current requests to the same domain. In order to overcome this restriction procore has 4 subdomains for fastly. This helper function will alternate between the subdomains in a sequence of 0-3 by default. The results are memoized, the same string will result with the same value.

Usage

cdn(numberOfDomains: number) {
  return cached(bgImg: string)
    return string
}

Example

import _cdn from '@procore/cdn';
import testImg from './test.png';
import bgImg from './bg.jpg';

const cdn = _cdn(4)

const App = () => {
  return (
    <div>
      <img src={cdn(testImg)} /> 
      /*
        https://procore-production-assets0.global.ssl.fastly.net/22028741.png
      */
      <div style={{ backgroundImage: `url(${cdn(bgImg)})`} />
      /*
        <div style="background-image: url(https://procore-production-assets1.global.ssl.fastly.net/03852981.jpg)></div>
      */
    </div>
  )
}

Keywords

FAQs

Package last updated on 29 Aug 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