Giter Site home page Giter Site logo

fast-assets's Introduction

fast-assets

Scripts and Stylesheets for Form.io Projects

Usage

Create a hidden component with the following default value (JavaScript)

const scripts = ['base.min.js'];
const styles = ['base.min.css'];
const head = document.getElementsByTagName('head')[0];

scripts.forEach(function(file) {
  const script = document.createElement('script');
  script.src = `https://fast-assets.surge.sh/js/${file}`;
  head.appendChild(script);
});

styles.forEach(function(file) {
  const style = document.createElement('link');
  style.rel = 'stylesheet';
  style.href = `https://fast-assets.surge.sh/css/${file}`;
  head.appendChild(style);
});

Functions

The following are a collection of available functions. Once the scripts are loaded, you may call these functions using custom javascript (either using default value, calculated value or custom button events).

getLocation()

Returns the latitude and longitude reported by the browser's navigator Geolocation Web API.

getLocation().then(function(pos) {
  // do something...
}).catch(function(err) {
  // handle navigator errors
});

takeScreenshot(config)

Returns the screenshot file object using the browser's navigator MediaDevice Web API

takeScreenshot().then(function(file) {
  // do something
}).catch(function(err) {
  // handle navigator errors
});

You can pass an optional configuration object to change some of the default settings

Property Description Type Default
message The dialog message String 'Take Screenshot'
options The dialog options Object {}
placeholder The image placeholder to use for blank image String ''
width The width (in pixels) to save the screenshot image Number 400
heigth The height (in pixels) to save the screenshot image Number 300

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.