index.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536
  1. System.register(["./application.js"], function (_export, _context) {
  2. "use strict";
  3. var Application, canvas, $p, bcr, application;
  4. function topLevelImport(url) {
  5. return System["import"](url);
  6. }
  7. return {
  8. setters: [function (_applicationJs) {
  9. Application = _applicationJs.Application;
  10. }],
  11. execute: function () {
  12. canvas = document.getElementById('GameCanvas');
  13. $p = canvas.parentElement;
  14. bcr = $p.getBoundingClientRect();
  15. canvas.width = bcr.width;
  16. canvas.height = bcr.height;
  17. application = new Application();
  18. FBInstant.initializeAsync().then(function () {
  19. FBInstant.setLoadingProgress(10);
  20. return topLevelImport('cc');
  21. }).then(function (engine) {
  22. FBInstant.setLoadingProgress(50);
  23. return application.init(engine);
  24. }).then(function () {
  25. FBInstant.setLoadingProgress(99);
  26. return application.start();
  27. }).then(function () {
  28. FBInstant.setLoadingProgress(100);
  29. return FBInstant.startGameAsync();
  30. })["catch"](function (err) {
  31. console.error(err);
  32. });
  33. }
  34. };
  35. });