cscript/wscript
Using Windows Script File format
<?xml version="1.0"?>
<job id="gpfExample">
<script language="JScript" src="gpf.js" />
<script language="JScript">
// use gpf namespace
</script>
</job>
Using Scripting.FileSystemObject object
var fso = new ActiveXObject("Scripting.FileSystemObject");
eval(fso.OpenTextFile("gpf.js", 1, false, 0).ReadAll());
// use gpf namespace
NodeJS
Using gpf.js directly
Assuming the file is in the same folder than your source.
var gpf = require("./gpf.js");
Using NPM package
To install the gpf-js package use:
npm install gpf-js --save
Then, in your code, you can access the release version with:
var gpf = require("gpf-js");
Or the debug version with:
var gpf = require("gpf-js/debug");
Rhino
Use load
load("./gpf.js");
// use gpf namespace
Nashorn
Use load
load("./gpf.js");
// use gpf namespace
PhantomJS
require("./gpf.js");
// use gpf namespace
or
<script src="gpf.js"></script>
<script>
// use gpf namespace
</script>
If you plan to use gpf.http.request, you may need to turn off security with --web-security=false
Browsers
<script src="gpf.js"></script>
<script>
// use gpf namespace
</script>