Skip to content

Commit

Permalink
Cleanup markdown sample code (#40)
Browse files Browse the repository at this point in the history
* Use const/let in sample code

* run eslint on markdown code

* run eslint on markdown code
  • Loading branch information
Christopher Baker committed Feb 15, 2018
1 parent 84d6f9c commit cdd090d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions doc/can-globals.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,20 @@
methods used to set and get global variables. For example, get the global [`location`](https://developer.mozilla.org/en-US/docs/Web/API/Window/location) object:

```js
const globals = require('can-globals');
import globals from "can-globals";

const LOCATION = globals.getKeyValue('location');
const LOCATION = globals.getKeyValue( "location" );
```

New keys can be defined with the `define` method, overwritten with the `set` method, and reset to their original value with the `reset` method.
All of these methods are demonstrated in the following example

```js
const globals = require('can-globals');
import globals from "can-globals";

globals.define('foo', 'bar'); // foo === 'bar'
globals.define( "foo", "bar" ); // foo === 'bar'

globals.set('foo', 'baz'); // foo === 'baz'
globals.set( "foo", "baz" ); // foo === 'baz'

globals.reset('foo'); // foo === 'bar'
globals.reset( "foo" ); // foo === 'bar'
```

0 comments on commit cdd090d

Please sign in to comment.