Skip to content

Commit

Permalink
travis #1: again fixed global BOTCH, and storage workaround
Browse files Browse the repository at this point in the history
- workaround for tests not findind storage error
  • Loading branch information
DavidLeoni committed Aug 17, 2020
1 parent ee0acd3 commit b342fcb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/extensions/botch/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,22 @@ class Scratch3Botch {
log.log('Botch: on PROJECT_LOADED');
this.storage = this.runtime.storage;
if (!this.storageHelper){
this.storageHelper = new BotchStorageHelper(this.runtime.storage);
this.storage.addHelper(this.storageHelper);
if (this.runtime.storage){ // in some tests it is not defined ...
this.storageHelper = new BotchStorageHelper(this.runtime.storage);
this.storage.addHelper(this.storageHelper);
} else {
log.log('this.runtime.storage is not defined, skipping BotchStorageHelper initialization');
}

}
// this.testStoreSprite();
}));

log.log('Botch runtime:', runtime);
log.log('Botch custom storageHelper:', this.storageHelper);

if (window){
// browser detection arcana https://stackoverflow.com/a/41863502
if (this.window === this){
window.BOTCH = this; // browser
} else {
global.BOTCH = this; // node
Expand Down

0 comments on commit b342fcb

Please sign in to comment.