Savehash() in Snowman 2

I’ve opened a bug in github for this, but perhaps a simple question will suffice.

According to the documentation, saveHash() is a function of window.story.

In a new Snowman story I create a starting passage:

:: test
<% window.story.saveHash() %>

When playing it I get: In Passage.render() using _.template(): TypeError: window.story.saveHash is not a function

If I see the contents of window.story in the console, there is no saveHash().

I’m using Snowman 2.0.2 and trying to use the save and restore system.

The <Story>.saveHash() method was removed from Snowman v2.0 and its functionality was merged into the <Story>.save() method. It no longer exists, so it still being referred to in places within the v2.0 source code—in comments, specifically—and in the documentation are errors.

I’m unsure why Dan removed it. While it was only used internally by <Story>.save(), it was also useful for external code to offer a better save experience than Snowman does natively, so its removal seems bizarre.


Thanks! I’ll check that today.

The function you want is

I removed saveHash() through combining it with save(). They now do both functionality in one function instead of calling save(), which was going to call saveHash() internally anyway.

A single call to save() will both set a hash AND return the hash it created.

If you have a good use case where you want a hash but don’t want to set a URL, I’ll consider breaking them apart again, but it is not currently a bug.

1 Like