1.5.1614271328 • Published 3 years ago

attach-embeds v1.5.1614271328

Weekly downloads
49
License
MIT
Repository
-
Last release
3 years ago

Attach Embeds

Injects

<script src="https://embeds.attach.live/v1#attach:initialize=manual" async defer></script>

to the page, caching calls until it's loaded and forwarding to the attach global otherwise.

Installation

npm

$ npm install --save attach-embeds

yarn

$ yarn add attach-embeds

Usage

import * as attach from 'attach-embeds'

if (!attach.isInitialized()) {
	attach.setProperties({
		'attach:error-reporting': false,
		'attach:error-handling': 'display',
	})
	attach.initialize()
}

attach.setProperty('attach:project:identity-color', 'blue')

attach.initialize()

Initializes the API. You always have to call this manually when using this package. You can also call it multiple times, as extra calls have no effect.

attach.isInitialized()

Returns true if the API is initialized, false otherwise.

May not necessarily return true right after calling attach.initialize().

attach.setProperty()

Set a global property. Accepts name and value.

See https://github.com/attach-live/attach-properties

attach.setProperties()

Set global properties. Accepts an object where key is the property name.

See https://github.com/attach-live/attach-properties