Javascript instance injection