Skip to content

Commit

Permalink
dispose
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelzoom authored Sep 22, 2021
1 parent d5bdea4 commit c622d6b
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions doc/implementation-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,23 @@ to `playAreaModelBounds`.

### Memory management

Unless otherwise documented in the source code, assume that `unlink`, `removeListener`, `dispose`
, etc. are generally not needed and that all listeners exist for the lifetime of the sim.
* **Listeners**: Unless otherwise noted in the code, all uses of `link`, `addListener`, etc. do NOT need a corresponding
`unlink`, `removeListener`, etc.

* **dispose**: Most sim-specific classes are not intended to be disposed, and therefore do not properly implement
`dispose`. Those classes will either have no `dispose` method, or will override their interited `dispose`
method like this:

```js
/**
* @public
* @override
*/
dispose() {
assert && assert( false, 'dispose is not supported, exists for the lifetime of the sim' );
super.dispose();
}
```

# Model

Expand Down

1 comment on commit c622d6b

@pixelzoom
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.