Skip to content

Commit

Permalink
Remove sections on IE8 usage
Browse files Browse the repository at this point in the history
We are not supporting IE8 any more.
  • Loading branch information
matthewp committed Jan 24, 2017
1 parent 4b96ead commit 4ea6159
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 118 deletions.
100 changes: 5 additions & 95 deletions docs/guides/guide.md
Expand Up @@ -346,6 +346,11 @@ When prompted, enter the name of the application created when you set up the Fir
node_modules/.bin/firebase login
```

Update your index.stache to change the production steal path:

@sourceref guides/guide/steps/16-cdn/index.stache
@highlight 36

Then we can deploy the application by running:

```
Expand Down Expand Up @@ -446,98 +451,3 @@ The Windows application can be opened with
In this guide we created a small chat application that connects to a remote API with DoneJS. It has routing between two pages and can send and receive messages in real-time. We built an optimized bundle for production and deployed it to a static file host and CDN. Last, we made builds of the application as a mobile and desktop application.

If you want to learn more about DoneJS - like how to create more complex custom elements and routes, write and automatically run tests, Continuous Integration and Continuous Deployment - head over to the [place-my-order Guide](./place-my-order.html).

## IE8 Support

This section is optional. Follow it only if you're interested in making applications that are compatible with IE8.

### Support CORS

Since our application uses cross domain requests we need to make a couple of changes to make it work in IE8 which doesn't support CORS. The first is to create a [jQuery prefilter](http://api.jquery.com/jquery.ajaxprefilter/) so all HTTP requests are marked as being cross domain. Create `src/prefilter.js`:

```js
import $ from "jquery";

$.ajaxPrefilter(function(options){
options.crossDomain = true;
});
```

Next we need to install [jQuery transport](http://api.jquery.com/jquery.ajaxtransport/) that will perform our cross domain requests in IE8:

```
npm install jquery-transport-xdr --save
```

Finally import both of these modules in your messages model. Change `src/models/message.js` to:

```js
import can from 'can';
import superMap from 'can-connect/can/super-map/';
import tag from 'can-connect/can/tag/';
import 'can/map/define/define';
import io from 'steal-socket.io';
import 'jquery-transport-xdr';
import 'donejs-chat/prefilter';

export const Message = can.Map.extend({
define: {}
});

Message.List = can.List.extend({
Map: Message
}, {});

export const messageConnection = superMap({
url: 'http://chat.donejs.com/api/messages',
idProp: 'id',
Map: Message,
List: Message.List,
name: 'message'
});

tag('message-model', messageConnection);

const socket = io('http://chat.donejs.com');

socket.on('messages created',
order => messageConnection.createInstance(order));
socket.on('messages updated',
order => messageConnection.updateInstance(order));
socket.on('messages removed',
order => messageConnection.destroyInstance(order));

export default Message;
```
@highlight 6,7

### Install jQuery 1.x

DoneJS comes with jQuery 2.x by default, but if you need to support IE8 the 1.x branch is necessary. You can switch by installing the right version:

```
npm install jquery@1.11.0 --save
```

Update your `build.js` file to make the compiled output work in IE:

```js
var buildPromise = stealTools.build({
config: __dirname + "/package.json!npm",
babelOptions: {
loose: "es6.modules"
}
}, {
bundleAssets: true
});
...
```
@highlight 2-5

And rebuild:

```
donejs build
```

The application will now work in IE8.
23 changes: 0 additions & 23 deletions guides/guide/steps/16-cdn/deploy.json

This file was deleted.

43 changes: 43 additions & 0 deletions guides/guide/steps/16-cdn/index.stache
@@ -0,0 +1,43 @@
<html>
<head>
<title>{{title}}</title>
</head>
<body>
<can-import from="bootstrap/less/bootstrap.less" />
<can-import from="donejs-chat/styles.less" />
<can-import from="donejs-chat/app" export-as="viewModel" />

<div class="container">
<div class="row">
<div class="col-sm-8 col-sm-offset-2">
{{#eq page 'chat'}}
<can-import from="donejs-chat/messages/">
{{#if isPending}}
Loading...
{{else}}
<chat-messages/>
{{/if}}
</can-import>
{{else}}
<can-import from="donejs-chat/home.component">
{{#if isPending}}
Loading...
{{else}}
<chat-home/>
{{/if}}
</can-import>
{{/eq}}
</div>
</div>
</div>

{{#switch env.NODE_ENV}}
{{#case "production"}}
<script src="{{joinBase 'steal.production.js'}}"></script>
{{/case}}
{{#default}}
<script src="/node_modules/steal/steal.js"></script>
{{/default}}
{{/switch}}
</body>
</html>

0 comments on commit 4ea6159

Please sign in to comment.