It's better to use a constant instead of "onsnapshotready".