Skip to content

Commit

Permalink
Unstable minification
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarkelov committed Feb 6, 2019
1 parent ea02ab6 commit 4ff861d
Show file tree
Hide file tree
Showing 4 changed files with 3,761 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/API.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* global document, window */
import minified from "./minified";

export default class VKApi {
constructor(apiId, options = {}) {
Expand All @@ -17,7 +18,7 @@ export default class VKApi {
init() {
const {
apiId,
options: { version, onlyWidgets }
options: { version, onlyWidgets, unstable_useMinified }
} = this;

if (this.promise) return this.promise;
Expand All @@ -42,7 +43,11 @@ export default class VKApi {

script.type = "text/javascript";
script.id = "vk-openapi";
script.src = baseUrl;
if (!unstable_useMinified) {
script.src = baseUrl;
} else {
script.text = minified;
}
script.async = true;

document.head.appendChild(script);
Expand Down
6 changes: 4 additions & 2 deletions src/VK.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ export default class VK extends React.Component {
apiId: PropTypes.number.isRequired,
options: PropTypes.shape({
version: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
onlyWidgets: PropTypes.bool
onlyWidgets: PropTypes.bool,
unstable_useMinified: PropTypes.bool
}),
onApiAvailable: PropTypes.func
};

static defaultProps = {
options: {
version: 160,
onlyWidgets: true
onlyWidgets: true,
unstable_useMinified: true
},
onApiAvailable: () => {}
};
Expand Down
1 change: 1 addition & 0 deletions src/minified.js

Large diffs are not rendered by default.

0 comments on commit 4ff861d

Please sign in to comment.