replace new function pattern with IIFE and fixes errors in example code
This commit is contained in:
parent
4d3430bf2b
commit
e690134478
4 changed files with 14 additions and 14 deletions
|
|
@ -136,7 +136,7 @@ myApp.users.index.view = function() {
|
|||
There's no rule for how you should organize code, and given that namespacing is often achieved with simple javascript, you can use simple javascript patterns to alias a long namespace and reduce the amount of typing:
|
||||
|
||||
```javascript
|
||||
new function() {
|
||||
!function() {
|
||||
var module = myApp.users.index = {}
|
||||
|
||||
module.vm = {/*...*/}
|
||||
|
|
@ -148,7 +148,7 @@ new function() {
|
|||
|
||||
return vm.something
|
||||
}
|
||||
}
|
||||
}()
|
||||
```
|
||||
|
||||
---
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue