clientside-require
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -546,3 +546,3 @@ (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){ | ||
this.provision.clientside_require_variables(frame, load_function); | ||
this.provision.browser_variables(frame); | ||
this.provision.browser_variables(frame, path); | ||
this.provision.commonjs_variables(frame, require_function); | ||
@@ -573,3 +573,3 @@ | ||
}, | ||
browser_variables : function(frame){ // browser environment variables (those not present in iframes) | ||
browser_variables : function(frame, path){ // browser environment variables (those not present in iframes) | ||
frame.contentWindow.console = window.console; // pass the console functionality | ||
@@ -581,2 +581,15 @@ frame.contentWindow.alert = window.alert; // pass the alert functionality | ||
frame.contentWindow.XMLHttpRequest = window.XMLHttpRequest; // pass the XMLHttpRequest functionality; using iframe's will result in an error as we delete the iframe that it is from | ||
// define window.location; https://stackoverflow.com/a/736970/3068233 | ||
var anchor = window.document.createElement("a"); | ||
anchor.href = path; | ||
frame.contentWindow.script_location = { | ||
href : anchor.href, | ||
origin : anchor.origin, | ||
protocol : anchor.protocol, | ||
host : anchor.host, | ||
hostname : anchor.hostname, | ||
port : anchor.port, | ||
pathname : anchor.pathname, | ||
}; | ||
}, | ||
@@ -583,0 +596,0 @@ commonjs_variables : function(frame, require_function){ // CommonJS environment variables |
{ | ||
"name": "clientside-require", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Node.js style require() statements in the browser. Load npm modules, js, html, css, json without any bundling.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -36,3 +36,3 @@ var basic_loaders = require("./basic.js"); | ||
this.provision.clientside_require_variables(frame, load_function); | ||
this.provision.browser_variables(frame); | ||
this.provision.browser_variables(frame, path); | ||
this.provision.commonjs_variables(frame, require_function); | ||
@@ -63,3 +63,3 @@ | ||
}, | ||
browser_variables : function(frame){ // browser environment variables (those not present in iframes) | ||
browser_variables : function(frame, path){ // browser environment variables (those not present in iframes) | ||
frame.contentWindow.console = window.console; // pass the console functionality | ||
@@ -71,2 +71,15 @@ frame.contentWindow.alert = window.alert; // pass the alert functionality | ||
frame.contentWindow.XMLHttpRequest = window.XMLHttpRequest; // pass the XMLHttpRequest functionality; using iframe's will result in an error as we delete the iframe that it is from | ||
// define window.location; https://stackoverflow.com/a/736970/3068233 | ||
var anchor = window.document.createElement("a"); | ||
anchor.href = path; | ||
frame.contentWindow.script_location = { | ||
href : anchor.href, | ||
origin : anchor.origin, | ||
protocol : anchor.protocol, | ||
host : anchor.host, | ||
hostname : anchor.hostname, | ||
port : anchor.port, | ||
pathname : anchor.pathname, | ||
}; | ||
}, | ||
@@ -73,0 +86,0 @@ commonjs_variables : function(frame, require_function){ // CommonJS environment variables |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
115680
1352