Compare commits

...

3 Commits

Author SHA1 Message Date
Rich Harris
dd6c51567a -> v0.8.2 2018-03-04 22:55:00 -05:00
Rich Harris
01ff84f241 Merge pull request #167 from sveltejs/gh-166
rename preloadRoutes to prefetchRoutes
2018-03-04 22:54:11 -05:00
Rich Harris
329c113723 rename preloadRoutes to prefetchRoutes 2018-03-04 22:38:55 -05:00
5 changed files with 15 additions and 8 deletions

View File

@@ -1,5 +1,9 @@
# sapper changelog # sapper changelog
## 0.8.2
* Rename `preloadRoutes` to `prefetchRoutes` ([#166](https://github.com/sveltejs/sapper/issues/166))
## 0.8.1 ## 0.8.1
* Add `sapper start` command, for running an app built with `sapper build` ([#163](https://github.com/sveltejs/sapper/issues/163)) * Add `sapper start` command, for running an app built with `sapper build` ([#163](https://github.com/sveltejs/sapper/issues/163))

View File

@@ -1,6 +1,6 @@
{ {
"name": "sapper", "name": "sapper",
"version": "0.8.1", "version": "0.8.2",
"description": "Military-grade apps, engineered by Svelte", "description": "Military-grade apps, engineered by Svelte",
"main": "middleware.js", "main": "middleware.js",
"bin": { "bin": {

View File

@@ -266,7 +266,7 @@ export function goto(href: string, opts = { replaceState: false }) {
} }
} }
export function preloadRoutes(pathnames: string[]) { export function prefetchRoutes(pathnames: string[]) {
if (!routes) throw new Error(`You must call init() first`); if (!routes) throw new Error(`You must call init() first`);
return routes return routes
@@ -282,3 +282,6 @@ export function preloadRoutes(pathnames: string[]) {
return promise.then(route.load); return promise.then(route.load);
}, Promise.resolve()); }, Promise.resolve());
} }
// remove this in 0.9
export { prefetchRoutes as preloadRoutes };

View File

@@ -1,8 +1,8 @@
import { init, preloadRoutes } from '../../../runtime.js'; import { init, prefetchRoutes } from '../../../runtime.js';
import { routes } from './manifest/client.js'; import { routes } from './manifest/client.js';
window.init = () => { window.init = () => {
return init(document.querySelector('#sapper'), routes); return init(document.querySelector('#sapper'), routes);
}; };
window.preloadRoutes = preloadRoutes; window.prefetchRoutes = prefetchRoutes;

View File

@@ -23,8 +23,8 @@ Nightmare.action('init', function(done) {
this.evaluate_now(() => window.init(), done); this.evaluate_now(() => window.init(), done);
}); });
Nightmare.action('preloadRoutes', function(done) { Nightmare.action('prefetchRoutes', function(done) {
this.evaluate_now(() => window.preloadRoutes(), done); this.evaluate_now(() => window.prefetchRoutes(), done);
}); });
function run(env) { function run(env) {
@@ -159,7 +159,7 @@ function run(env) {
}); });
it('navigates to a new page without reloading', () => { it('navigates to a new page without reloading', () => {
return capture(() => nightmare.goto(base).init().preloadRoutes()) return capture(() => nightmare.goto(base).init().prefetchRoutes())
.then(() => { .then(() => {
return capture(() => nightmare.click('a[href="/about"]')); return capture(() => nightmare.click('a[href="/about"]'));
}) })