{"id":3656,"date":"2020-07-02T12:32:59","date_gmt":"2020-07-02T18:32:59","guid":{"rendered":"http:\/\/bililite.com\/blog\/?p=3656"},"modified":"2020-07-02T12:32:59","modified_gmt":"2020-07-02T18:32:59","slug":"implementing-the-history-interface","status":"publish","type":"post","link":"https:\/\/bililite.com\/blog\/2020\/07\/02\/implementing-the-history-interface\/","title":{"rendered":"Implementing the History interface"},"content":{"rendered":"<p>The way browser history is implemented, with the <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/API\/History\">History interface<\/a>, is useful for other things than site navigation. The same idea, basically an extended stack that allows going back and forward, is the same algorithm used for undo\/redo, and command line history. <\/p>\n<p>It would be nice to be able to do <code class=\"language-javascript\" >const h = new History()<\/code> and <code class=\"language-javascript\" >h.pushState(someData)<\/code> with arbitrary states, but the browser won't let you construct a new instance of <code class=\"language-javascript\" >History<\/code>. It's only accessible from <code class=\"language-javascript\" >window.history<\/code>.<\/p>\n<p>So I re-defined <code class=\"language-javascript\" >History<\/code> to allow this.<\/p>\n<p>See the details on the <a href=\"http:\/\/github.bililite.com\/historystack\">github site<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The way browser history is implemented, with the History interface, is useful for other things than site navigation. The same idea, basically an extended stack that allows going back and forward, is the same algorithm used for undo\/redo, and command line history. It would be nice to be able to do const h = new [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/3656"}],"collection":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/comments?post=3656"}],"version-history":[{"count":1,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/3656\/revisions"}],"predecessor-version":[{"id":3657,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/posts\/3656\/revisions\/3657"}],"wp:attachment":[{"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/media?parent=3656"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/categories?post=3656"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bililite.com\/blog\/wp-json\/wp\/v2\/tags?post=3656"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}