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

ember-quine

v1.3.0

Published

Ember addon to build apps as self contained HTML files

Downloads

3

Readme

ember-quine

A quine is a computer program which takes no input and produces a copy of its own source code as its only output. ~ Quine (computing) - Wikipedia

Ember Quine is an Ember addon that enables an Ember app to be self downloaded as a single HTML file that runs offline (via the file:// URI).

This is best understood through demonstration. Vist the live example and play with it.

Compatibility

  • Ember.js v3.4 or above
  • Ember CLI v2.13 or above
  • Node.js v8 or above

Installation

ember install ember-quine

By default all JS and CSS assets are compiled into the final index.html file. To disabled this (for development purposes) add the following to your config/environment.js:

ENV['ember-quine'] = { enabled: false };

Usage

This addon provides a quine service which exposes methods to download the app and load/save/remove data from the document storage mechanism.

Downloading the Quine App

Use the download() method to have the browser download a copy of the current running quine.

import Component from '@ember/component';
import { inject as service } from '@ember/service';

export default Component.extend({
  quine: service(),

  actions: {
    download(filename) {
      this.quine.download(filename);
    }
  }
});

This works by reading the HTML nodes (head and body) and capturing their innerHTML. It then constructs a new HTML document with string concatenation. It then builds a new tag with its href set to the constructed HTML. It adds the tag to the document, triggers a click action, and then removes the element.

quine.download(filename)

Initiates a download of the quine. It will reset quine.isDirty to false.

Triggered Events

  • didDownload

Params

  • filename string|undefined - the filename to save as. Will default to the application name. It will add an .html extension if missing.

Data Storage

The data storage provided saves data to the DOM directly. See Data Store section for more information.

quine.loadStore(storeName)

Loads the data from the DOM and returns the value stored.

Returns: any - The payload stored in the data store or undefined if not found

Params

  • storeName string - The name of the store to load

quine.saveStore(storeName, data)

Saves data to the DOM. Will set quine.isDirty to true.

Triggered Events

  • didSaveStore - passes an object with a storeName property
  • didChange

Params

  • storeName string - The name of the store to save
  • data any - The payload to be saved to the data store

quine.destroyStore(storeName)

Removes a stored set of data by storeName from the DOM. Will set quine.isDirty to true.

Triggered Events

  • didDestroyStore - passes an object with a storeName property
  • didChange

Params

  • storeName string - The name of the store to destroy

quine.destroyAllStores()

Removes all data from the DOM. quine.isDirty to true.

Triggered Events

  • didDestroyAllStores
  • didChange

Contributing

See the Contributing guide for details.

License

This project is licensed under the MIT License.