Skip to content

Commit c889481

Browse files
authored
Merge pull request MicrosoftDocs#1548 from Power-Maverick/patch-5
🙌 Updated examples on all 4 control method
2 parents 59a8bb6 + 8f50499 commit c889481

File tree

4 files changed

+26
-23
lines changed

4 files changed

+26
-23
lines changed

powerapps-docs/developer/component-framework/reference/control/destroy.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,15 @@ Model-driven apps and canvas apps (public preview)
2222

2323
## Example
2424

25-
```javascript
26-
MyControl.prototype.destroy = function () {
27-
this.button.removeEventListener("click", this.onButtonClick);
28-
};
25+
```TypeScript
26+
public destroy(): void
27+
{
28+
this.button.removeEventListener("click", this.onButtonClick);
29+
}
2930
```
3031

3132
### Related topics
3233

3334
[Control](../control.md)<br/>
3435
[Power Apps component framework API reference](../../reference/index.md)<br/>
35-
[Power Apps component framework overview](../../overview.md)
36+
[Power Apps component framework overview](../../overview.md)

powerapps-docs/developer/component-framework/reference/control/getoutputs.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,26 @@ Model-driven apps and canvas apps (public preview)
2626
The output will contain a value for each property marked as `input-output` or `bound` in the manifest.
2727
For example, if the manifest has a property `value` that is an `input-output`, and you want to set that to the local variable `myvalue` you should return:
2828

29-
```javascript
29+
```TypeScript
3030
{
3131
value: myvalue
3232
}
3333
```
3434

3535
## Example
3636

37-
```javascript
38-
MyControl.prototype.getOutputs = function () {
39-
var result = {
37+
```TypeScript
38+
public getOutputs(): IOutputs
39+
{
40+
return {
4041
value: this._value
4142
};
42-
return result;
43-
};
43+
}
4444
```
4545

4646

4747
### Related topics
4848

4949
[Control](../control.md)<br/>
5050
[Power Apps component framework API reference](../../reference/index.md)<br/>
51-
[Power Apps component framework overview](../../overview.md)
51+
[Power Apps component framework overview](../../overview.md)

powerapps-docs/developer/component-framework/reference/control/init.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,13 @@ Model-driven apps and canvas apps (public preview)
3232

3333
## Example
3434

35-
```JavaScript
36-
MyNameSpace.JSHelloWorldControl.prototype.init = function (context, notifyOutputChanged, state, container) {
37-
this._labelElement = document.createElement("label");
38-
this._labelElement.setAttribute("class", "JS_HelloWorldColor");
39-
container.appendChild(this._labelElement);
40-
};
35+
```TypeScript
36+
public init(context: ComponentFramework.Context<IInputs>, notifyOutputChanged: () => void, state: ComponentFramework.Dictionary, container:HTMLDivElement)
37+
{
38+
this._labelElement = document.createElement("label");
39+
this._labelElement.setAttribute("class", "HelloWorldColor");
40+
container.appendChild(this._labelElement);
41+
}
4142
```
4243

4344
### Related topics

powerapps-docs/developer/component-framework/reference/control/updateview.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ Model-driven apps and canvas apps (public preview)
2929

3030
## Example
3131

32-
```JavaScript
33-
MyNameSpace.JSHelloWorldControl.prototype.updateView = function (context) {
34-
this._labelElement.innerText = "Hello World! (JS)";
35-
};
32+
```TypeScript
33+
public updateView(context: ComponentFramework.Context<IInputs>): void
34+
{
35+
this._labelElement.innerText = "Hello World! (TS)";
36+
}
3637
```
3738

3839
## Remarks
@@ -44,4 +45,4 @@ Set the value of the field component to the raw value from the configured field
4445

4546
[Control](../control.md)<br/>
4647
[Power Apps component framework API reference](../../reference/index.md)<br/>
47-
[Power Apps component framework overview](../../overview.md)
48+
[Power Apps component framework overview](../../overview.md)

0 commit comments

Comments
 (0)