Skip to content
This repository has been archived by the owner on Dec 15, 2020. It is now read-only.

Commit

Permalink
Documentation Updates for NonBlobBridge
Browse files Browse the repository at this point in the history
Summary:
Update documentaion to explain what `NonBlobBridge.js` is and why it's required.
Declare clear that don't need to touch this file and it will be automatically bundled.
Explain how to migrate old project to use it.

Reviewed By: MartinSherburn

Differential Revision: D14264037

fbshipit-source-id: b4e628be4e2516399778ad67a6e5277f01d73b6d
  • Loading branch information
larrylin28 authored and facebook-github-bot committed Mar 6, 2019
1 parent e9e4e6a commit 1b15835
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
11 changes: 11 additions & 0 deletions docs/explore-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,17 @@ Finally, the starter project immediately adds a 360 background photo. This part

This is the web page you load when viewing your application. All it does is provide a point to mount your JavaScript code. This is intentional. Most functionality is left out of HTML, so that you can easily integrate your React 360 application into server-render pages or existing web apps.

### `NonBlobBridge.js`

This is the bridge code to start react-360 executor. It runs a bridge in web worker to handle messages sending between `client.js` and `index.js`. Generally you don't need to touch any code in this file.

**Important**

`NonBlobBridge.js` doesn't exist in `react-360`(< 1.1.1), we were using an inline blob URL as the bridge code. But this may cause a security issue in the Chrome Browser that makes your app not work when hosted in a high secured CDN server. If you are using `react-360-cli`(>= 1.1.1), it will automatically use `NonBlobBridge.js` in the new project. If you have project created via `react-360-cli`(< 1.1.1), upgrading your `react-360` and `react-360-web` version won't break your app, and you can run the following code to migrate to use `NonBlobBridge.js`:
```
node node_modules/react-360/scripts/install-bridge.js
```

## Exploring the Starter Project

Digging into `index.js`, we can see how the contents viewed on your screen are composed in React code. If you're not yet familiar with how React works, you should first read through the documentation at https://reactjs.org/.
Expand Down
5 changes: 3 additions & 2 deletions docs/publish.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ sidebar_label: Build for Production

Running on the local server is only for development. Once you're ready to publish your app, you'll need to build prodution versions of the code.

React 360 includes a command that packages everything up into a single folder. Running `npm run bundle` from the root directory of your project will create production builds of your JS, create a copy of your `index.html` file pointing to the production JS, and place it all in a new `build` directory. To publish your application, copy the contents of this directory to your server. If you used any files in the `static_assets` directory, you should also copy this folder to your server. The layout of the files should resemble the following structure:
React 360 includes a command that packages everything up into a single folder. Running `npm run bundle` from the root directory of your project will create production builds of your JS, create a copy of your `index.html` and `NonBlobBridge.js` file pointing to the production JS, and place it all in a new `build` directory. To publish your application, copy the contents of this directory to your server. If you used any files in the `static_assets` directory, you should also copy this folder to your server. The layout of the files should resemble the following structure:

```
Web Server
├─ static_assets/
├─ index.html
├─ index.bundle.js
└─ client.bundle.js
├─ client.bundle.js
└─ NonBlobBridge.js
```

It's also possible to place your static assets in a different location. You can learn more about this in the next section.

0 comments on commit 1b15835

Please sign in to comment.