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

hot-app

v1.0.2

Published

App wrapper to make it start, stop and restart easily through the browser console or f.e. webpack hot reload.

Downloads

2

Readme

HotApp.js

Simple wrapper to make your js app start, stop and restart easily through the browser console or f.e. webpack hot reload system.

Console screen: https://www.dropbox.com/s/epb4dntthllphhi/Screenshot%202016-10-09%2021.18.48.png?dl=0

Video: https://drive.google.com/file/d/0B5-IASgGnqwdT2JUcWpVTUpmZnM/view

Usage examples

preboot/angular-webpack seed with hot-app

https://github.com/jtomaszewski/angular-webpack/tree/hot-app

AngularClass/angular2-webpack-starter with hot-app

https://github.com/jtomaszewski/angular2-webpack-starter/tree/hot-app

Webpack, hot reload, angular1 with angular2 upgrade

// -- helpers
function requireAll(r) { r.keys().forEach(r); }

// define the ng1 app module, only if not defined yet
if (!window.__ng1AppDefined) {
  angular.module("app", []);
}
window.__ng1AppDefined = true;

// Require the ng1 app code: its' directives, components, services code and so on
//
// NOTE Your ng1 code should use angular-hot library
//      (https://github.com/jtomaszewski/angular-hot)
//      If not, propably it will raise error while redefining the ng1 directives/components.
requireAll(require.context('./ng1/', true, /\.js$/));

// Require the ng2 app code: the ngmodule and all its requires should be in upgrade_adapter.ts code
import { adapter } from './upgrade_adapter';

// Now, let's use the HotApp to run the app and eventually restart it, if needed

import { HotApp } from 'hot-app';

const app = (<any>window).app = new HotApp({
  oldApp: (<any>window).app,
  getRootElement: function() { return document.body; },
  startFn: (app, onStart) => {
    app.data.ng2 = adapter.bootstrap(app.getRootElement(), ['app'], {strictDi: false});
    app.data.ng2.ready(() => {
      onStart();
    });
  },
  stopFn: (app, onStop) => {
    app.data.ng2.dispose();
    onStop();
  }
});

app.startOnDOMReady();

// Webpack hot reload support
if (module.hot) {
  module.hot.accept();

  module.hot.dispose(() => {
    app.stop();
  });
}

Webpack, hot reload, angular2


// Require the ng2 app code: the ngmodule and all its requires should be in upgrade_adapter.ts code
import { adapter } from './upgrade_adapter';

// Now, let's use the HotApp to run the app and eventually restart it, if needed

import { HotApp } from 'hot-app';

export function main(): Promise<any> {
  return platformBrowserDynamic()
    .bootstrapModule(AppModule)
    .catch(err => console.error(err));
}

const app = (<any>window).app = new HotApp({
  oldApp: (<any>window).app,
  getRootElement: function() { return document.body; },
  startFn: (app, onStart) => {
    main().then(moduleRef => {
      app.data.moduleRef = moduleRef;
      onStart();
    });
  },
  stopFn: (app, onStop) => {
    app.data.moduleRef.destroy();
    onStop();
  }
});

app.startOnDOMReady();

// Webpack hot reload support
if (module.hot) {
  module.hot.accept();

  module.hot.dispose(() => {
    app.stop();
  });
}

Webpack, hot reload, angular1

// -- helpers
function requireAll(r) { r.keys().forEach(r); }

// define the ng1 app module, only if not defined yet
if (!window.__ng1AppDefined) {
  angular.module("app", []);
  window.__ng1AppDefined = true;
}

// Require the ng1 app code: its' directives, components, services code and so on
//
// NOTE Your ng1 code should use angular-hot library
//      (https://github.com/jtomaszewski/angular-hot)
//      If not, propably it will raise error while redefining the ng1 directives/components.
requireAll(require.context('./ng1/', true, /\.js$/));

const app = window.app = new HotApp({
  oldApp: window.app,
  getRootElement: function() { return document.body; },
  startFn: (app, onStart) => {
    angular.bootstrap(app.getRootElement(), ['app'], {strictDi: false});
    onStart();
  },
  stopFn: (app, onStop) => {
    angular.element(app.getRootElement()).injector().get('$rootScope').$destroy();
    onStop();
  }
});
app.startOnDOMReady();

// Webpack hot reload support
if (module.hot) {
  module.hot.accept();

  module.hot.dispose(() => {
    app.stop();
  });
}

License

MIT

Contribution, Bug reports, Questions

Just use github issues or pull requests! ;)