Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Function to set the window title #82

Open
nomeata opened this issue Aug 10, 2016 · 1 comment
Open

Function to set the window title #82

nomeata opened this issue Aug 10, 2016 · 1 comment

Comments

@nomeata
Copy link
Contributor

nomeata commented Aug 10, 2016

Currently, the browser tab displaying the blank canvas app says Blank Canvas. Which is a lie as soon as the canvas is filled :-).

I propose a function setTitle :: Text -> Canvas () that would, well, set the the title.

@RyanGlScott
Copy link
Member

Good idea! Luckily, this kind of thing is super-easy to add to blank-canvas.

The trickiest part is adding the JavaScript functionality. You'd need to add something like this to static/index.html:

function SetTitle(newTitle) { // :: Text -> Canvas ()
    return function(u, c) {
        document.title = newTitle;
        $.kc.reply(u, []); // Return unit tuple
    };
}

Once that's done, all you need to do is add a new SetTitle constructor to the Query datatype, as well as corresponding cases to the InstrShow instance and parseQueryResult.

Then setTitle simply becomes:

setTitle :: Text -> Canvas ()
setTitle = procedure . Query . SetTitle

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

No branches or pull requests

2 participants