Skip to content

Commit

Permalink
Merge pull request #461 from visionmedia/mult2
Browse files Browse the repository at this point in the history
Add page.create() to allow multiple pages
  • Loading branch information
matthewp committed Sep 7, 2018
2 parents cc40bc4 + 263f938 commit 1002924
Show file tree
Hide file tree
Showing 7 changed files with 1,401 additions and 1,193 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Expand Up @@ -20,5 +20,6 @@
"trailing": false,
"smarttabs": true,
"latedef": false,
"indent": 2
"indent": 2,
"validthis": true
}
19 changes: 16 additions & 3 deletions Readme.md
Expand Up @@ -159,6 +159,7 @@ page('/default');
- `dispatch` perform initial dispatch [__true__]
- `hashbang` add `#!` before urls [__false__]
- `decodeURLComponents` remove URL encoding from path components (query string, pathname, hash) [__true__]
- `window` provide a window to control (by default it will control the main window)

If you wish to load serve initial content
from the server you likely will want to
Expand Down Expand Up @@ -205,6 +206,18 @@ page.exit('/sidebar', function(ctx, next) {

Equivalent to `page.exit('*', callback)`.

### page.create([options])

Create a new page instance with the given options. Options provided
are the same as provided in `page([options])` above. Use this if you need
to control multiple windows (like iframes or popups) in addition
to the main window.

```js
var otherPage = page.create({ window: iframe.contentWindow });
otherPage('/', main);
```

### Context

Routes are passed `Context` objects, these may
Expand Down Expand Up @@ -537,7 +550,7 @@ Before calling `page.base()` use: `history.redirect([prefixType], [basepath])` -
* An objective should be a chunk of code that is related but requires explanation.
* Commits should be in the form of what-it-is: how-it-does-it and or why-it's-needed or what-it-is for trivial changes
* Pull requests and commits should be a guide to the code.

## Server configuration

In order to load and update any URL managed by page.js, you need to configure your environment to point to your project's main file (index.html, for example) for each non-existent URL. Below you will find examples for most common server scenarios.
Expand All @@ -559,10 +572,10 @@ If using Apache, create (or add to) the `.htaccess` file in the root of your pub
```apache
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^.*$ ./index.html
```

Expand Down

0 comments on commit 1002924

Please sign in to comment.