Skip to content
This repository has been archived by the owner on May 10, 2019. It is now read-only.

Update example for GOVUK modules to be consistent with current codebase #93

Merged
merged 1 commit into from
Jul 5, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions js.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,20 @@ Modules should be wrapped in a closure and attach themselves to the global
`GOVUK` object.

```
(function() {
(function(global) {
"use strict";
window.GOVUK = window.GOVUK || {};
var $ = window.jQuery;

var $ = global.jQuery;
var GOVUK = global.GOVUK || {};

...

GOVUK.myModule = ...
}());

...

global.GOVUK = GOVUK;
})(window);
```

**Why:** attaching to the `GOVUK` object keeps us from polluting the global
Expand Down