Skip to content

Commit d179608

Browse files
committed
Add ability to disable snipcart JS autoloading
1 parent c255c14 commit d179608

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/snipcart.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,19 @@ function SnipcartProvider() {
88
'use strict';
99

1010
this.apiKey = null;
11+
this.autoLoad = true;
1112
this.customFields = [];
1213
this.$get = ['$window', '$rootScope', function ($window, $rootScope) {
13-
return new Service($window, $rootScope, this.apiKey, this.customFields);
14+
return new Service($window, $rootScope, this.autoLoad, this.apiKey, this.customFields);
1415
}];
1516

16-
function Service($window, $rootScope, apiKey, customFields) {
17+
function Service($window, $rootScope, autoLoad, apiKey, customFields) {
1718

1819
var service = {};
19-
load();
20+
service.load = load;
21+
if(autoLoad) {
22+
service.load();
23+
}
2024

2125
return service;
2226

0 commit comments

Comments
 (0)