npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@teletron/magic-mirror-wrapper-web

v0.1.2

Published

This NPM package provides the functionality required for the web part of a Teletron extension that wraps a [magic mirror](https://magicmirror.builders) module.

Downloads

5

Readme

magic-mirror-wrapper-web

This NPM package provides the functionality required for the web part of a Teletron extension that wraps a magic mirror module.

The author of this wrapper is in no way affiliated with the Magic Mirror project. He is however a fan of the project and the community that has been build around it. This wrapper must be seen as an ode to magic mirror. This code is, similar to the Magic Mirror codebase, released under the MIT license.

Installation and usage

There are two ways to use this extension, using vanilla javascript, or by using a bundler, such as webpack or vite.

Vanilla

To use the umd version of this package, download it from unpkg.com and store it somewhere, so that the @teletron/magic-mirror-wrapper-node package can make it available to Teletron.

wget https://unpkg.com/@teletron/magic-mirror-wrapper-web -O web.umd.js
wget https://unpkg.com/@teletron/magic-mirror-wrapper-web/build/web.css -O web.css

This will download the latest version of the wrapper script, and its CSS file.

Then create a script, and have that script served by the backend wrapper (as explained in that modules' README):

// web.js

// Invoke the teletronRegisterExtension global to register the module.
async function extensionStart() {
  if (typeof magicMirrorWrapperWeb === 'undefined') {
    // Wait until the magicMirrorWrap global is available
    setTimeout(() => extensionStart(), 100);
    return;
  }
  const teletron = window.teletronRegisterExtension('extension-name');
  magicMirrorWrapperWeb.start(teletron, 'component-name', 'module-name');
}
extensionStart();

Update the backend code for the extension accordingly, so that it will load the css and js file that you downloaded earlier.

Bundler

First, install the npm package, then use it in the source folder you have assigned for your bundler.

npm install @teletron/magic-mirror-wrapper-web

Then create a script:

import { start } from '@teletron/magic-mirror-wrapper-web';
import from '@teletron/magic-mirror-wrapper-web/build/web.css';

async function extensionStart() {
  const teletron = window.teletronRegisterExtension('extension-name');
  magicMirrorWrapperWeb.start(teletron, 'component-name', 'module-name');
}
extensionStart();

Update the backend code for the extension accordingly, so that it will load the css and js file that are built by the bundler.

Debugging

To debug what happens in the browser, execute the following in your browser console and refresh the page:

localStorage.setItem('mmDebug', true);

// to disable, execute and refresh the page
localStorage.removeItem('mmDebug');

This will enable the debug logger to start sending out messages.

Contributing

Contributions are welcome. This does not necessarily have to be code, it can also be updated documentation, tutorials, bug reports or pull requests.

Please create an issue to propose a feature you want to implement, so that the details can be discussed in advance.

The major/minor version of this package reflect the last version tag of magic mirror. So that it is clear against which version of Magic Mirror the wrapper has been tested.