Most of these are window fields that wanted `window.` prepended, but a
couple of issues are code that was using undefined variables (`ht` and
`dir_uuid`) and some switch-cases that I believe are intentionally
falling through.
/puter/src/helpers.js
39:55 error 'auth_token' is not defined no-undef
47:14 error 'api_origin' is not defined no-undef
55:40 error 'auth_token' is not defined no-undef
59:17 error 'logout' is not defined no-undef
199:14 error 'api_origin' is not defined no-undef
208:40 error 'auth_token' is not defined no-undef
212:17 error 'logout' is not defined no-undef
224:14 error 'api_origin' is not defined no-undef
234:40 error 'auth_token' is not defined no-undef
238:17 error 'logout' is not defined no-undef
316:13 error Expected a 'break' statement before 'case' no-fallthrough
323:13 error Expected a 'break' statement before 'case' no-fallthrough
330:13 error Expected a 'break' statement before 'case' no-fallthrough
337:13 error Expected a 'break' statement before 'case' no-fallthrough
367:47 error Unnecessary escape character: \/ no-useless-escape
411:14 error 'isString' is not defined no-undef
420:47 error 'config' is not defined no-undef
519:21 error 'globToRegExp' is not defined no-undef
651:14 error Empty block statement no-empty
656:9 error 'update_auth_data' is not defined no-undef
678:36 error 'api_origin' is not defined no-undef
722:5 error 'update_user_preferences' is not defined no-undef
740:24 error 'uuidv4' is not defined no-undef
746:9 error 'appCallbackFunctions' is not defined no-undef
789:14 error 'api_origin' is not defined no-undef
794:40 error 'auth_token' is not defined no-undef
861:33 error 'trash_path' is not defined no-undef
867:21 error Empty block statement no-empty
889:70 error 'trash_path' is not defined no-undef
891:59 error 'trash_path' is not defined no-undef
894:49 error 'trash_path' is not defined no-undef
907:29 error 'docs_path' is not defined no-undef
909:35 error 'pictures_path' is not defined no-undef
911:35 error 'home_path' is not defined no-undef
913:35 error 'videos_path' is not defined no-undef
915:35 error 'desktop_path' is not defined no-undef
1037:5 error 'getItem' is not defined no-undef
1041:17 error 'setItem' is not defined no-undef
1070:54 error Empty block statement no-empty
1089:51 error 'ht' is not defined no-undef
1091:20 error 'desktop_loading_fade_delay' is not defined no-undef
1150:27 error 'operation_id' is not defined no-undef
1151:5 error 'operation_cancelled' is not defined no-undef
1169:21 error 'activate_item_name_editor' is not defined no-undef
1172:21 error 'actions_history' is not defined no-undef
1181:54 error 'copy_progress_hide_delay' is not defined no-undef
1187:37 error 'copy_progress_hide_delay' is not defined no-undef
1211:21 error 'activate_item_name_editor' is not defined no-undef
1214:21 error 'actions_history' is not defined no-undef
1245:22 error 'operation_id' is not defined no-undef
1246:5 error 'operation_cancelled' is not defined no-undef
1249:5 error 'update_explorer_footer_selected_items_count' is not defined no-undef
1263:24 error 'clipboard' is not defined no-undef
1264:29 error 'clipboard' is not defined no-undef
1273:20 error 'operation_cancelled' is not defined no-undef
1302:38 error 'clipboard' is not defined no-undef
1303:38 error 'clipboard' is not defined no-undef
1327:9 error 'actions_history' is not defined no-undef
1335:40 error 'copy_progress_hide_delay' is not defined no-undef
1341:29 error 'copy_progress_hide_delay' is not defined no-undef
1354:22 error 'operation_id' is not defined no-undef
1377:20 error 'operation_cancelled' is not defined no-undef
1432:9 error 'actions_history' is not defined no-undef
1440:40 error 'copy_progress_hide_delay' is not defined no-undef
1446:29 error 'copy_progress_hide_delay' is not defined no-undef
1486:17 error 'update_explorer_footer_item_count' is not defined no-undef
1487:17 error 'update_explorer_footer_selected_items_count' is not defined no-undef
1500:8 error 'clipboard' is not defined no-undef
1501:24 error 'clipboard' is not defined no-undef
1502:61 error 'clipboard' is not defined no-undef
1505:13 error 'move_items' is not defined no-undef
1508:5 error 'clipboard' is not defined no-undef
1537:23 error 'api_origin' is not defined no-undef
1537:84 error 'auth_token' is not defined no-undef
1556:34 error 'uuidv4' is not defined no-undef
1565:45 error 'get_apps' is not defined no-undef
1572:13 error This branch can never execute. Its condition is a duplicate or covered by previous conditions in the if-else-if chain no-dupe-else-if
1639:21 error 'root_dirname' is not defined no-undef
1684:37 error 'gui_origin' is not defined no-undef
1711:60 error 'app_domain' is not defined no-undef
1723:64 error 'auth_token' is not defined no-undef
1737:49 error 'auth_token' is not defined no-undef
1748:12 error 'api_origin' is not defined no-undef
1749:64 error 'api_origin' is not defined no-undef
1800:13 error 'launch_apps' is not defined no-undef
1803:13 error 'launch_apps' is not defined no-undef
1803:43 error 'launch_apps' is not defined no-undef
1806:13 error 'launch_apps' is not defined no-undef
1806:34 error 'launch_apps' is not defined no-undef
1810:22 error 'api_origin' is not defined no-undef
1819:48 error 'auth_token' is not defined no-undef
1867:56 error 'trash_path' is not defined no-undef
1873:34 error 'trash_path' is not defined no-undef
1942:30 error 'busy_indicator_hide_delay' is not defined no-undef
1948:25 error 'busy_indicator_hide_delay' is not defined no-undef
1954:48 error 'user_preferences' is not defined no-undef
1955:9 error 'launch_app' is not defined no-undef
1956:19 error 'user_preferences' is not defined no-undef
1967:9 error 'launch_app' is not defined no-undef
1978:25 error 'item_icon' is not defined no-undef
1992:9 error 'window_nav_history' is not defined no-undef
1992:45 error 'window_nav_history' is not defined no-undef
1992:88 error 'window_nav_history_current_position' is not defined no-undef
1993:9 error 'window_nav_history' is not defined no-undef
1994:9 error 'window_nav_history_current_position' is not defined no-undef
1996:9 error 'update_window_path' is not defined no-undef
2009:22 error 'api_origin' is not defined no-undef
2017:48 error 'auth_token' is not defined no-undef
2021:25 error 'logout' is not defined no-undef
2025:20 error Empty block statement no-empty
2029:70 error 'suggest_apps_for_fsentry' is not defined no-undef
2040:17 error 'unzipItem' is not defined no-undef
2057:17 error 'trigger_download' is not defined no-undef
2065:13 error 'launch_app' is not defined no-undef
2087:22 error 'operation_id' is not defined no-undef
2088:5 error 'operation_cancelled' is not defined no-undef
2129:12 error 'operation_cancelled' is not defined no-undef
2166:30 error Empty block statement no-empty
2173:20 error 'operation_cancelled' is not defined no-undef
2182:34 error 'trash_path' is not defined no-undef
2196:55 error 'trash_path' is not defined no-undef
2196:116 error 'trash_path' is not defined no-undef
2197:57 error 'trash_path' is not defined no-undef
2201:46 error 'trash_path' is not defined no-undef
2215:47 error 'trash_path' is not defined no-undef
2254:25 error 'update_explorer_footer_item_count' is not defined no-undef
2255:25 error 'update_explorer_footer_selected_items_count' is not defined no-undef
2260:34 error 'trash_path' is not defined no-undef
2270:25 error 'update_window_path' is not defined no-undef
2274:34 error 'trash_path' is not defined no-undef
2279:46 error 'dir_uuid' is not defined no-undef
2302:33 error 'item_icon' is not defined no-undef
2303:42 error 'trash_path' is not defined no-undef
2309:47 error 'trash_path' is not defined no-undef
2331:41 error 'item_icon' is not defined no-undef
2343:21 error 'sort_items' is not defined no-undef
2348:21 error 'sort_items' is not defined no-undef
2391:47 error 'trash_path' is not defined no-undef
2397:51 error 'trash_path' is not defined no-undef
2398:53 error 'trash_path' is not defined no-undef
2413:34 error 'trash_path' is not defined no-undef
2414:9 error 'actions_history' is not defined no-undef
2418:40 error 'trash_path' is not defined no-undef
2419:9 error 'actions_history' is not defined no-undef
2428:12 error 'copy_progress_hide_delay' is not defined no-undef
2641:21 error 'upload_items' is not defined no-undef
2659:21 error 'trash_path' is not defined no-undef
2679:21 error 'show_save_account_notice_if_needed' is not defined no-undef
2683:17 error 'active_uploads' is not defined no-undef
2695:17 error 'active_uploads' is not defined no-undef
2714:17 error 'actions_history' is not defined no-undef
2722:25 error 'show_save_account_notice_if_needed' is not defined no-undef
2723:33 error 'upload_progress_hide_delay' is not defined no-undef
2726:24 error 'active_uploads' is not defined no-undef
2733:24 error 'active_uploads' is not defined no-undef
2739:24 error 'active_uploads' is not defined no-undef
2766:17 error 'uuidv4' is not defined no-undef
2772:16 error 'trash_path' is not defined no-undef
2782:47 error 'trash_path' is not defined no-undef
2782:108 error 'trash_path' is not defined no-undef
2783:37 error 'trash_path' is not defined no-undef
2786:36 error 'trash_path' is not defined no-undef
2788:13 error 'update_explorer_footer_item_count' is not defined no-undef
2788:71 error 'trash_path' is not defined no-undef
2793:28 error 'copy_progress_hide_delay' is not defined no-undef
2799:28 error 'copy_progress_hide_delay' is not defined no-undef
2815:18 error 'api_origin' is not defined no-undef
2818:42 error 'auth_token' is not defined no-undef
2991:28 error 'copy_progress_hide_delay' is not defined no-undef
2998:28 error 'copy_progress_hide_delay' is not defined no-undef
3066:24 error 'copy_progress_hide_delay' is not defined no-undef
3074:24 error 'copy_progress_hide_delay' is not defined no-undef
3086:17 error 'actions_history' is not defined no-undef
3095:17 error 'suggest_apps_for_fsentry' is not defined no-undef
3104:95 error 'truncate_filename' is not defined no-undef
3104:123 error 'TRUNCATE_LENGTH' is not defined no-undef
3111:84 error 'item_icon' is not defined no-undef
3150:23 error 'update_sites_cache' is not defined no-undef
3153:27 error 'determine_website_url' is not defined no-undef
3158:17 error 'update_window_path' is not defined no-undef
3166:17 error 'sort_items' is not defined no-undef
3171:34 error 'truncate_filename' is not defined no-undef
3171:66 error 'TRUNCATE_LENGTH' is not defined no-undef
3205:9 error 'actions_history' is not defined no-undef
3206:29 error 'actions_history' is not defined no-undef
3211:13 error 'undo_create_file_or_folder' is not defined no-undef
3214:13 error 'rename_file' is not defined no-undef
3217:13 error 'undo_upload' is not defined no-undef
3220:13 error 'undo_copy' is not defined no-undef
3223:13 error 'undo_move' is not defined no-undef
3226:13 error 'undo_delete' is not defined no-undef
3249:26 error 'get_html_element_from_options' is not defined no-undef
3251:9 error 'move_items' is not defined no-undef
3257:26 error 'get_html_element_from_options' is not defined no-undef
3259:9 error 'move_items' is not defined no-undef
3265:21 error 'global_element_id' is not defined no-undef
3282:23 error 'determine_website_url' is not defined no-undef
3324:42 error 'byte_format' is not defined no-undef
3381:116 error 'truncate_filename' is not defined no-undef
3381:148 error 'TRUNCATE_LENGTH' is not defined no-undef
3396:5 error 'is_auto_arrange_enabled' is not defined no-undef
3398:5 error 'desktop_item_positions' is not defined no-undef
3408:8 error 'reset_item_positions' is not defined no-undef
3409:9 error 'delete_desktop_item_positions' is not defined no-undef
3415:26 error 'desktop_item_positions' is not defined no-undef
3426:44 error 'desktop_item_positions' is not defined no-undef
3430:5 error 'desktop_item_positions' is not defined no-undef
3438:28 error 'is_fullscreen' is not defined no-undef
3462:14 error 'window_for_app_instance' is not defined no-undef
3469:31 error 'iframe_for_app_instance' is not defined no-undef
3483:23 error 'window_for_app_instance' is not defined no-undef
3514:42 error Unnecessary escape character: \[ no-useless-escape
3514:59 error Unnecessary escape character: \/ no-useless-escape
puter.ui.launchApp() returns a Promise that needs to resolve whether the
app uses the Puter SDK or not. Non-SDK apps are tricky because they
don't send a READY message on startup, and we don't know in advance
whether an app will use the SDK or not.
This is a workaround to ensure that launchApp() always resolves. When an
app is closed, if it wasn't using the SDK, we send an artificial
notification that it launched, followed by an extra notification that
it has closed (because the original close notification was sent before
this point). This means any users of launchApp() can await it, and get
an AppConnection, and listen to the close event. They can't otherwise
interact with a non-SDK app because it will have closed already, but we
can improve this in the future without breaking the API.
Apps are not required to use the Puter SDK. If they don't, then we can
still launch them, close them, and listen to their close event, but are
unable to send messages to them.
Send an appClosed message with the instance ID of the app that was
closed. This will be picked up by Puter.js's AppConnection and reported
as a 'close' event.
To make this work, a `data-parent_instance_id` attribute is set on child
app windows. This is very similar to the `data-parent_uuid` attribute,
which tracks parent windows instead of parent app instances. (Dialogs
have a parent window, but are not apps, so don't have a parent app
instance.) The difference is subtle, and we may want to combine these in
the future, but currently closing an app will close any child windows,
which is not behaviour we want for child apps.
This is left open to future additions, by naming it 'locale', and having
the language just be an object field.
Side note, maybe we should have a LocaleService for this?
Calling `puter.ui.launchApp()` now treats the new app as a child of the
one that launched it.
A child app is given a `puter.parent_instance_id` URL param, containing
its parent's instance ID.
Previously, `launchApp()` would resolve as soon as the app was launched.
This commit changes that, so that it is notified after the child app
sends its READY event to Puter. This means that as soon as `launchApp()`
has completed, the child app is ready to receive messages. The downside
is that launching an app that does not include Puter.js will now not
cause a notification, so `await puter.ui.launchApp()` will not resolve
in that case.