Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

emberx

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emberx

What if ember router was a tiny and explicitly resolvable router you could import from npm. Flexible and simple API below can be progressively backward-compatible and support current ember router definitions!

  • 1.0.1
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

API Design

What if ember router was a tiny and explicitly resolvable router you could import from npm. Flexible and simple API below can be progressively backward-compatible and support current ember router definitions!

import Router from 'emberx-npm';

import IndexRoute from './routes/index/route.ts';
import IndexRouteTemplate from './routes/index/template.hbs';

import PostsRoute from './routes/posts/route.ts';
import PostsRouteTemplate from './routes/posts/template.hbs';
import PostsIndexRoute from './routes/posts/index/route.ts';
import PostsIndexRouteTemplate from './routes/posts/index/template.hbs';

import PostsPostRoute from './routes/posts/post/route.ts';
import PostsPostRouteTemplate from './routes/posts/post/template.hbs';

Router.start([
  {
    path: '/',
    route: IndexRoute,
    template: IndexRouteTemplate
  },
  {
    path: '/posts',
    route: PostsRoute,
    template: PostsRouteTemplate
    indexRoute: PostsIndexRoute,
    indexTemplate: PostsIndexRouteTemplate
  },
  {
    path: '/posts/:slug',
    route: PostsPostRoute,
    template: PostsPostRouteTemplate
  }
]);

// OR templates should be embedable inside RouteDefinition.template = hbs`` just like glimmerx components

Router API also includes Router.map(routerDefinition) that can turn existing ember route definition to a specific tree structure for router_js. Router.map(function() {}) is something I might tackle later, it will resolve existing ember routers implicitly with a resolver definition(classic or MUD).

Backward-compatible API suggestion:
import Router from 'emberx-npm';
import SomeCustomResolver from './custom-resolver';

Router.resolver = SomeCustomResolver;

let existingMapDefinition = Router.map(function () {
  this.route("public", { path: "/" }, function () {
    this.route("index", { path: "/" });
    this.route("blog-post", { path: "/:slug" });
  });

  this.route("admin", function () {
    this.route("index", { path: "/" });
  });

  this.route("settings");
  this.route("login");
});

Router.start([
  {
    path: '/',
    route: IndexRoute,
    template: IndexRouteTemplate
  },
  {
    path: '/posts',
    route: PostsRoute,
    template: PostsRouteTemplate
    indexRoute: PostsIndexRoute,
    indexTemplate: PostsIndexRouteTemplate
  }
], existingMapDefinition);

This experiment is also a sketch for a new ember edition. It lifts up our very old ember router and makes it the most flexible, simple, mature, powerful and modern SPA router ever built. Therefore maybe we should call it ember supernova edition ;) This can literally make ember the no-brainer choice for frontend development, removing all build and asset size concerns many outsiders have.

FAQs

Package last updated on 12 Sep 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc