Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

angular-jsdom-renderer

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-jsdom-renderer

Helps render angular pages on the server-side.

  • 0.5.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

Angular JSDom Renderer

Build Status NPM version Dependency Status Gittip donate button Analytics

Helps render angular pages on the server-side.

Installation

npm install angular-jsdom-renderer

Usage


// render using an interval poll selector
var renderer = require('angular-jsdom-renderer');

renderer.render({
	/* url to retrieve the html from */
	url: 'http://localhost:7559/',

	/* poll this selector until a match is found */
	pollSelector: 'body[data-content-loaded=true]',
	
	/* how often to poll the given selector. default 500 */
	pollSelectorMs: 100,
	
	/* how long to wait to give up polling selector. default 60000 */
	timeoutMs: 60000,
	
	/* complete callback. this = config */
	done: function(errors, window) {
		if (errors) {
			console.log(errors);
			return;
		}

        var document = window.document;
        var compiledHtml = document.outerHTML;
		// var angular = window.angular
		console.log(compiledHtml);

		// window will close after this callback
	}
});
// render using a timeout only
var renderer = require('angular-jsdom-renderer');

renderer.render({
	/* url to retrieve the html from */
	url: 'http://localhost:7559/',
	
	/* how long to wait until rendering the content. default 5000 */
	timeoutMs: 5000,
	
	/* complete callback. this = config */
	done: function(errors, window) {
		if (errors) {
			console.log(errors);
			return;
		}
		
        var document = window.document;
        var compiledHtml = document.outerHTML;
		// var angular = window.angular
		console.log(compiledHtml);

		// window will close after this callback
	}
});

####Run the examples

API


	/* renders the give url or file or html string */
	
	render({
		/* raw html. optional but must provide either url|file|html */
		html: '',
		/* raw file. optional but must provide either url|file|html  */
		file: config.file,
		/* raw url. optional but must provide either url|file|html  */
		url: '',
		/* injects script urls in to the html to be rendered */
		scripts: [],
		/* injects script statements in to the html to be rendered */
		src: [],
		/* see jsdom for more info - https://github.com/tmpvar/jsdom#how-it-works */
		features: config.features,
		/* see jsdom for more info - https://github.com/tmpvar/jsdom#doneerrors-window */
		done: function(jsdomErrors, window){},
		/* polls a selector until a match is found and then passes the rendered html to the config.done callback */
		pollSelector: 'body[data-content-loaded=true]'. default '',
		/* how often to poll the given selector. default 500 */
		pollSelectorMs: 500,
		/* how long to wait to give up polling selector. default 60000 */
		timeoutMs: 60000,
	});
	

Contributing

Feel free to submit ideas and issues.

License

Licensed under the incredibly permissive MIT License
Copyright © 2014+ Stringz Solutions Ltd
Copyright © 2014+ Peter Flannery

Keywords

FAQs

Package last updated on 20 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc