Skip to content

Add some basic print methods - #140

Merged
hadley merged 10 commits into
mainfrom
print-methods
Feb 5, 2024
Merged

hadley merged 10 commits into
mainfrom
print-methods

Conversation

@hadley

@hadley hadley commented Jan 30, 2024

Copy link
Copy Markdown
Member
library(chromote)

default_chromote_object()
#> <Chromote> (active)
#>   URL:  http://127.0.0.1:38235
#>   PID:  11387
#>   Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

ChromoteSession$new()
#> <ChromoteSession> (active)
#>   Session ID: 6F1CB69127F8DF4A567EAEC27E57745B
#>   Target ID:  BEBCB2096CE541CC13F25EBBA5748937
#>   Parent PID: 11387

Created on 2024-01-30 with reprex v2.0.2.9000

@hadley
hadley requested a review from wch January 30, 2024 21:59
@wch

wch commented Jan 30, 2024

Copy link
Copy Markdown
Collaborator

I like this summarized info, but for debugging purposes, I also often find it useful to see all the public and private stuff, so that I can find what to poke at. (Those IDs emitted by the new print methods are also only useful for debugging.)

Is there some way that we could make it obvious for people to figure out how to print all that other info?

Comment thread R/chromote_session.R
mark_closed = function(target_closed) {
private$session_is_active <- FALSE
private$target_is_active <- target_closed
private$target_is_active <- !target_closed

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops

@hadley

hadley commented Feb 2, 2024

Copy link
Copy Markdown
Member Author

Now looks like this:

library(chromote)

x <- ChromoteSession$new()
x
#' <ChromoteSession> (session + target active)
#'   Session ID: D6A397FF2C4E44C53D67CC7F44CDD87C
#'   Target ID:  7C7D2B9E67D70B01A9664F143047205E
#'   Parent PID: 22035

x$parent
#' <Chromote> (active + alive)
#'   URL:  http://127.0.0.1:20993
#'   PID:  22035
#'   Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome


# sleep --------------

x
#' <ChromoteSession> (target active)
#'   Target ID:  7C7D2B9E67D70B01A9664F143047205E
#'   Parent PID: 22035

x$parent
#' <Chromote> (alive)
#'   URL:  http://127.0.0.1:20993
#'   PID:  22035
#'   Path: /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

@hadley
hadley merged commit e84718a into main Feb 5, 2024
@hadley
hadley deleted the print-methods branch February 5, 2024 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants