Skip to content

Commit 4f39005

Browse files
committed
Example custom page data
1 parent 44d067b commit 4f39005

File tree

1 file changed

+22
-0
lines changed
  • frameworks/react/workspace/src/views

1 file changed

+22
-0
lines changed

frameworks/react/workspace/src/views/View2.tsx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import OpenFin from "@openfin/core";
12
import React, { useEffect, useState } from "react";
23
import logo from "../logo.svg";
34

@@ -33,6 +34,22 @@ function View2() {
3334
}
3435
}
3536

37+
function handleSaveCustomData() {
38+
console.log('Setting custom data');
39+
const view = fin.me as OpenFin.View
40+
view.updateOptions({
41+
customData: {
42+
foo: 'bar'
43+
}
44+
})
45+
}
46+
47+
async function handleGetCustomData() {
48+
const view = fin.me as OpenFin.View
49+
const options = await view.getOptions();
50+
console.log('Custom Data', options.customData);
51+
}
52+
3653
return (
3754
<div className="col fill gap20">
3855
<header className="row spread middle">
@@ -52,6 +69,11 @@ function View2() {
5269
</pre>
5370
</fieldset>
5471
<button onClick={() => setMessage("")}>Clear</button>
72+
73+
<hr/>
74+
75+
<button onClick={handleSaveCustomData}>Save Page custom data</button>
76+
<button onClick={handleGetCustomData}>Get Page custom data</button>
5577
</main>
5678
</div>
5779
);

0 commit comments

Comments
 (0)