-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(remove httpclientmodule): refactor to drop depedency on httpClien… (
#182) * fix(remove httpclientmodule): refactor to drop depedency on httpClientModule This refactor takes care of the httpClientModule, by replacing it with a fetchHttp from our own making. * feat(transferstate): refactor to use a global, instead of parsion on intial page update the tranferstate to prepare it for external JSON, and a little optimized flow * improvement(transer-state.service): use index.html to prevent unneeded 301 read the index.html instead of the urls itself. Saves a round-trip to the server. * fix(transferstate): make sure there are no emmisions of state _during_ routing Make sure state is only emitted after routing has finished, to make sure the state doesn't get transfered to the old page. * improvement(transerstate): make sure state doesn't get emmitted during navigation This makes sure the state doesn't get emmited before navigation is done. * fix(transferstate): move navigationDome to correct place * improvement(transferstateservice): don't emit state during navigation with this, the getstate will _never_ emit a value **during** navigation. Only when navigation is done, the state will be available.
- Loading branch information
1 parent
213247f
commit 0929c2f
Showing
11 changed files
with
138 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const {routeSplit, registerPlugin, httpGet} = require('../dist/scully'); | ||
|
||
const newsSamplePlugin = async (route, config) => { | ||
const {createPath} = routeSplit(route); | ||
const list = await httpGet('http://localhost:4200/assets/news.json'); | ||
const handledRoutes = []; | ||
for (item of list) { | ||
const blogData = await httpget(`http://localhost:4200/assets/news/${list.id}.json`); | ||
handledRoutes.push({ | ||
route: createPath(item.id, blogdata.slug), | ||
title: blogData.title, | ||
description: blogData.short, | ||
}); | ||
} | ||
}; | ||
|
||
registerPlugin('router', 'myBlog', newsSamplePlugin); | ||
|
||
const config = { | ||
'/news/:id/:slug': { | ||
type: 'myBlog', | ||
postRenderers: postRenderers, | ||
}, | ||
}; | ||
|
||
/** | ||
* | ||
'/news/:id/:slug': { | ||
type: 'json', | ||
postRenderers: postRenderers, | ||
id: { | ||
url: 'http://localhost:4200/assets/news.json', | ||
property: 'id', | ||
}, | ||
slug: { | ||
url: 'http://localhost:4200/assets/news/${id}.json', | ||
property: 'slug', | ||
}, | ||
}, | ||
{ | ||
"id": 5, | ||
"slug": "newsitem-5", | ||
"title": "Newsitem #5", | ||
"short": "Lorem ipsum dolor .." | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
import {HttpClient} from '@angular/common/http'; | ||
import {ModuleWithProviders, NgModule} from '@angular/core'; | ||
import {NgModule} from '@angular/core'; | ||
import {ScullyContentComponent} from './scully-content/scully-content.component'; | ||
|
||
@NgModule({ | ||
declarations: [ScullyContentComponent], | ||
exports: [ScullyContentComponent], | ||
}) | ||
export class ComponentsModule { | ||
static forRoot(): ModuleWithProviders<ComponentsModule> { | ||
return { | ||
ngModule: ComponentsModule, | ||
providers: [HttpClient], | ||
}; | ||
} | ||
} | ||
export class ComponentsModule {} |
16 changes: 3 additions & 13 deletions
16
projects/scullyio/ng-lib/src/lib/route-service/scully-routes.service.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 5 additions & 16 deletions
21
projects/scullyio/ng-lib/src/lib/scully-content/scully-content.component.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.