Crate quad_url[][src]

quad-url

This is the crate to work with URL and open links in miniquad/macroquad environment.

Web demo.

Usage

Add this to your Cargo.toml dependencies:

quad-url = "0.1.0"

Usage in WASM

Add file quad-url/js/quad-url.js to your project.

Add file sapp-jsutils/js/sapp_jsutils.js file to your project. (version 0.1.4, compatible with current crate)

Add this lines after loading of gl.js and after loading of your wasm in your index.html:

<script src="sapp_jsutils.js"></script>
<script src="quad-url.js"></script>

Done! Now you can use this crate.

Functions

delete_program_parameter

Deletes «command line parameters» in URL. Has no effect outside WASM.

easy_parse

Parses result from get_program_parameters returning (name, value).

get_hash

Returns string after hash in URL. Returns empty string on non-WASM target.

get_program_parameters

Function to get «command line parameters» from query string in URL.

link_open

If not WASM, then open link in browser. If target is WASM, then link can be opened in the same tab, or in a new tab. But when link is opened in a new tab, browser may block it and ask user permission to do it.

path

Returns path to current program. Returns just std::env::args().nth(0) for non-WASM. And returns current URL before search params and before hash with full = false, returns full url with full = true.

set_hash

Set string after hash in URL. Has no effect on non-WASM target.

set_program_parameter

Set «command line parameters» in URL. Has no effect outside WASM.