New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

aframe-post-message-component

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aframe-post-message-component

An optionated postMessage component for A-Frame.

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

aframe-post-message-component

Version License

A simple component that reads a JSON object from the Post Message API or from the URL Parameters and fires an event. A common usage scenario would be to update the applications state.

For A-Frame.

API

post-message

This component listes to events from the element and redirects the event detail via postMessage to its parent window. So it only works if the whole A-Frame scene is embedded within an IFrame. The format of the posted message is {type: '', event: '', data: {}}, where the type property is the type and the event as in the schema and the data is the events detail object.

PropertyDescriptionDefault Value
enabledListen to events and send data as a post message to its parent windowAFRAME.utils.isIframed
typeThe type name of the post message for the parent to identify
eventEvent name to listen and redirect as a post messageloaded

listen-message

Must be attached to the scene entity.

The sent data in the postMessage is opionated by this library and must be of the format {type: '', event: '', data: {}} whereas the event property is optional. The type property must correspond with the type given in the components configuration.

PropertyDescriptionDefault Value
enabledListen to postMessage eventstrue
typeThe type name of the Post Message data to be check
defaultEventEvent name to be fired when the received postMessage has no event propertymessagePosted

url-parameter

Must be attached to the scene entity.

The URL parameter is in the form &parameter={} whereas the parameter name is defined by the schema and defaults to message

PropertyDescriptionDefault Value
enabledRead URL GET Parameters once when the scene is loadedtrue
parameterQuery parameter key name to recognize message frommessage
defaultEventEvent name to be fired when the received message has no event propertymessagePosted

Installation

Browser

Install and use by directly including the browser files:

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.6.0/aframe.min.js"></script>
  <script src="https://unpkg.com/aframe-post-message-component/dist/aframe-post-message-component.min.js"></script>
</head>

<body>
  <a-scene post-message listen-message url-parameter>
  </a-scene>
</body>

npm

Install via npm:

npm install aframe-post-message-component

Then require and use.

require('aframe');
require('aframe-post-message-component');

Keywords

aframe

FAQs

Package last updated on 29 Aug 2018

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