Skip to content
This repository has been archived by the owner on Jun 29, 2020. It is now read-only.

Latest commit

 

History

History
56 lines (39 loc) · 1.28 KB

how-to-import.md

File metadata and controls

56 lines (39 loc) · 1.28 KB

how-to-import

If you're not familiar with the different ways that you can use JavaScript modules, I suggest you find an article or a wiki page. There are way more qualified people that can explain this better than me.

Obviously, this module wasn't meant to be used server side. If you're using TypeScript or require, you're gonna need a bundler like rollup, browserify, or webpack.

CommonJS

Node resolution:

const browserZoomListener = require("browser-zoom-listener");

Just a file:

const browserZoomListener = require("./dist/lib.cjs");

ESM

import browserZoomListener from "./dist/lib.mjs";

TypeScript

Node resolution:

import browserZoomListener from "browser-zoom-listener/src/lib";
// works without synthetic default export

IIFE

<script src="./dist/lib.iife.js"></script>
<script>
   browserZoomListener;
</script>

The Fast Way

Copy the stuff in this file. It's one big expression that goes into browserZoomListener.

Don't worry about licencing because it's free and unencumbered software.