https://github.com/kuzalekon/gamble
Gamble is a small and simply javascript library for dynamically add a resource-hints in your web pages
https://github.com/kuzalekon/gamble
assets browser hints javascript js resource resource-hints resources util utility
Last synced: 3 months ago
JSON representation
Gamble is a small and simply javascript library for dynamically add a resource-hints in your web pages
- Host: GitHub
- URL: https://github.com/kuzalekon/gamble
- Owner: kuzalekon
- License: mit
- Created: 2018-03-15T21:14:28.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-19T08:38:22.000Z (almost 8 years ago)
- Last Synced: 2025-10-22T09:25:11.382Z (4 months ago)
- Topics: assets, browser, hints, javascript, js, resource, resource-hints, resources, util, utility
- Language: JavaScript
- Homepage:
- Size: 53.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

A small and simply javascript library for dynamically add a resource-hints in your web pages
### Installation
You can install `gamble` using npm, yarn or bower:
```
$ npm install gamble
$ yarn add gamble
$ bower install gamble
```
### Usage
Note: the library is exports as **UMD module**.
```js
const gamble = require('gamble');
// dns-prefetch
gamble({
rel: 'dns-prefetch',
href: 'https://domain.com'
});
// prefetch a script with CORS
gamble({
rel: 'prefetch',
href: 'https://domain.com/script.js',
as: 'script',
crossorigin: 'use-credentials'
});
// preload a HTML page
gamble({
rel: 'preload',
href: 'https://domain.com/index.html',
as: 'html'
});
// prerender a page
gamble({
rel: 'prerender',
href: 'https://domain.com/index.html'
});
```