@@ -42,7 +42,6 @@ const myPage = page('My Plugin Page', {
42
42
| ` on(event, callback) ` | Adds an event listener to the page |
43
43
| ` off(event, callback) ` | Removes an event listener from the page |
44
44
| ` setTitle(title) ` | Updates the page title |
45
- | ` show() ` | Makes the page visible |
46
45
| ` hide() ` | Hides the page |
47
46
48
47
## Properties
@@ -55,6 +54,10 @@ const myPage = page('My Plugin Page', {
55
54
| ` textContent ` | string | The page's text content |
56
55
| ` lead ` | HTMLElement | The lead element if defined |
57
56
57
+ ::: info
58
+ You'll need to implement ` show ` method according to your situation at your own.
59
+ :::
60
+
58
61
## Example
59
62
60
63
Here's a complete example of creating a settings page for a plugin:
@@ -69,7 +72,7 @@ function createSettingsPage() {
69
72
70
73
const saveButton = tag (' span' , {
71
74
className: ' icon save' ,
72
- onclick: saveSettings
75
+ onclick : () => { console . log ( " save settings " )}
73
76
});
74
77
75
78
// Initialize page
@@ -87,6 +90,15 @@ function createSettingsPage() {
87
90
88
91
form .append (input);
89
92
settingsPage .appendBody (form);
93
+ settingsPage .show = () => {
94
+ // to have proper behaviour for mobile back button press, check actionStack doc for more
95
+ const actionStack = acode .require (" actionStack" );
96
+ actionStack .push ({
97
+ id: " some_id" ,
98
+ action: settingsPage .hide ,
99
+ });
100
+ app .append (settingsPage);
101
+ };
90
102
91
103
// Show the page
92
104
settingsPage .show ();
0 commit comments