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

meta-setter

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

meta-setter

Singleton Object to dynamically update document meta tags in client side applications. WIP

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

MetaSetter

Easily and dynamically update document meta tags in clientside applications.

The Singleton pattern

Whenever you require('meta-setter') it will return the same javascript object in all spots. This is known as the Singleton pattern.

Why is this useful?

The MetaSetter object is a simple singleton object that has 3 methods: init, updateMetaTags, and Reset. MetaSetter is extremely useful in client side applications, especially when attaching it to a typical Global App Object App.metaSetter = require('meta-setter') that is usually required in other parts of the application. When required you can easily update the document meta tags by simply passing in a spec object, typically a derived property from a model in the application or an object created on the fly and passed through to the updateMetaTags method on 'static' pages within the application. App.metaSetter.updateMetaTags({});

install

npm install --save-dev meta-setter

API Reference

init MetaSetter.init(obj)

Initializes the singleton object with a set of default meta tag values

var MetaSetter = require('meta-setter');

MetaSetter.init({
	'title': 'Some Default Title',
	'og:title': 'Some Default Open Graph Title',
	'og:description': 'Default Open Graph Description',
	'og:image': 'Default Open Graph Image URL',
	'og:url': window.location.host,
	'og:type': 'website'
});

reset MetaSetter.reset()

Resets document meta tags back to the original default states.

credits

Created by @imjakechapman.

license

MIT

Keywords

FAQs

Package last updated on 29 Jun 2015

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