Giter VIP home page Giter VIP logo

webperf-helper's Introduction

WEB PERFORMANCE HELPER

A library which will contain helper functions for boosting our application's performance.

Install

npm install @mehmetsefabalik/webperf-helper

Use In Your Application

import { handle } from "@mehmetsefabalik/webperf-helper/dist/network"

Bundle It and Use As a Script

  • Clone
 git clone https://github.com/mehmetsefabalik/webperf-helper.git
  • Install Dependencies
npm i
  • Bundle
npx webpack

Now you can use ./dist/network.js file as you want, for example upload it to a CDN and use it as <script src="yourCdnPath/network.js"></script>

The script will detect the device's network status, and set the network status as network-status cookie, so you can look at the cookie to determine device's network status either on client-side and server-side.

Modules

Network

Network module contains helper functions to detect, store, read device's network status. We can use this information for adaptive loading.

Handle Function
import { handle } from "@mehmetsefabalik/webperf-helper/dist/network"

handle();

Detects the device's network status and sets it as network-status cookie.

NetworkStatus Function
import { networkStatus } from "@mehmetsefabalik/webperf-helper/dist/network"

const status = networkStatus();

Returns the device's network status.

GetNetworkStatusCookie Function
import { getNetworkStatusCookie } from "@mehmetsefabalik/webperf-helper/dist/network"

const status = getNetworkStatusCookie();

Returns the network-status cookie.

webperf-helper's People

Contributors

mehmetsefabalik avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.