Skip to content

Commit

Permalink
Pass skqw object to paramChange, update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Jul 30, 2016
1 parent e8ce19b commit 40d2fc1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
### v1.0.0-alpha.2 (unreleased)
#### Features
* Pass the skqw object to paramChange function as first argument.
#### Fixes
* Fix devtools opening when using full-screen shortcut.
* Disable text selection in settings menu.
Expand Down
6 changes: 3 additions & 3 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is a description of the APIs for authoring visualizations in SKQW.
For a general overview, see the [dev guide](./dev-guide.md).

## `skqw` object
The `skqw` object is passed as an argument to most of the lifecycle
The `skqw` object is passed as the first argument of each of the lifecycle
functions (see Visualization interface below).

```TypeScript
Expand Down Expand Up @@ -59,7 +59,7 @@ interface IVisualization {
tick: (skqw: ISkqw, timestamp: number) => void;
resize?: (skqw: ISkqw) => void;
destroy?: (skqw: ISkqw) => void;
paramChange?: (change: IParamUpdate) => void;
paramChange?: (skqw: ISkqw, change: IParamUpdate) => void;
params?: { [name: string]: IParameter }
}

Expand Down Expand Up @@ -102,7 +102,7 @@ Called whenever the app window is resized.
Called just before unloading the visualization, as when a different
visualization is selected in the UI.

#### `visualization.paramChange(change)`
#### `visualization.paramChange(skqw, change)`

Called whenever the user changes a param in the UI.

Expand Down
2 changes: 1 addition & 1 deletion docs/dev-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Then we set the fillStyle property, since we don't plan to change it in this
simple example.

#### `skqw` object
This object is passed as a parameter to most of the visualization
This object is passed as the first parameter to each of the visualization
lifecycle functions. It has a single method, `createCanvas()`, which
will create an HTML canvas element which we can then draw on to.

Expand Down
2 changes: 1 addition & 1 deletion src/common/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface IVisualization {
tick: (skqw: ISkqw, timestamp: number) => void;
resize?: (skqw: ISkqw) => void;
destroy?: (skqw: ISkqw) => void;
paramChange?: (change: IParamUpdate) => void;
paramChange?: (skqw: ISkqw, change: IParamUpdate) => void;
params?: { [name: string]: IParameter }
}

Expand Down
2 changes: 1 addition & 1 deletion src/render/components/visualizer/visualizer.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export class Visualizer {

updateParam(paramUpdate: IParamUpdate): void {
if (this.visualization && typeof this.visualization.paramChange === 'function') {
this.visualization.paramChange(paramUpdate);
this.visualization.paramChange(this.skqw, paramUpdate);
}
}

Expand Down

0 comments on commit 40d2fc1

Please sign in to comment.