Skip to content

Commit

Permalink
Merge pull request zendesk#76 from zendesk/roman/best_practices
Browse files Browse the repository at this point in the history
add note about not patching common JS objects
  • Loading branch information
sandlerr committed Oct 6, 2015
2 parents 2185a59 + f60778a commit 4e55593
Showing 1 changed file with 3 additions and 16 deletions.
19 changes: 3 additions & 16 deletions Bestpractices.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,15 @@ If you aren't sure about any of the points below, if you have questions about th

* Do not use an out-dated framework version

* Do not declare a function outside the main returned object, ever.
* Do not try to access the `window` object that may interfere with the new Zendesk or other Apps (even via an external library)

```js
(function() {
var FooClass = function() {}; // Never do this
FooClass.bar = function() {}; // Or this

var foobar = "raboof"; // This is fine

return {
};
}());
```

* Never try to access the `window` object that may interfere with the new Zendesk or other Apps (even via an external library)

* Never load any external libraries using AJAX, for example:
* Do not load any external libraries using AJAX, for example:

```
this.ajax('getScript', 'mylibrary.js'),
```

* Do not alter the behavior of Javascript classes that will be used outside of your app such as `String` and `Array`.

## Zendesk Apps: Best Practices

Expand Down

0 comments on commit 4e55593

Please sign in to comment.