Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extras merged into engine #6228

Merged
merged 21 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@ jobs:
- name: Build PlayCanvas (ESM-only)
run: npm run build:esm

- name: Build PlayCanvas Extras
run: npm run build:extras

- name: Build TypeScript declarations
run: npm run build:types

Expand Down
Binary file removed examples/bundle.tar
Binary file not shown.
1 change: 0 additions & 1 deletion examples/iframe/example.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
document.addEventListener('DOMContentLoaded', () => {
loader.start({
engineUrl: '@ENGINE',
extrasUrl: './playcanvas-extras/index.js',
exampleUrl: '@EXAMPLE',
controlsUrl: '@CONTROLS'
});
Expand Down
9 changes: 3 additions & 6 deletions examples/iframe/loader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,13 @@ class ExampleLoader {
}

/**
* @param {{ engineUrl: string, extrasUrl: string, exampleUrl: string, controlsUrl: string }} options - Options to start the loader
* @param {{ engineUrl: string, exampleUrl: string, controlsUrl: string }} options - Options to start the loader
*/
async start({ engineUrl, extrasUrl, exampleUrl, controlsUrl }) {
async start({ engineUrl, exampleUrl, controlsUrl }) {
window.pc = await import(engineUrl);
window.pcx = await import(extrasUrl);

// @ts-ignore
window.top.pc = window.pc;
// @ts-ignore
window.top.pcx = window.pcx;

files['example.mjs'] = await fetchFile(exampleUrl);
files['controls.mjs'] = await fetchFile(controlsUrl);
Expand Down Expand Up @@ -135,7 +132,7 @@ class ExampleLoader {
}

/**
* @param {*} enabled - The enabled state of ministats
* @param {boolean} enabled - The enabled state of ministats
*/
setMiniStats(enabled = false) {
MiniStats.enable(this._app, enabled);
Expand Down
6 changes: 3 additions & 3 deletions examples/iframe/ministats.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { getQueryParams } from '@examples/utils';
const params = getQueryParams(window.top?.location.href ?? '');

export default class MiniStats {
/** @type {import('playcanvas-extras').MiniStats | null} */
/** @type {import('playcanvas').MiniStats | null} */
static instance = null;

/**
Expand All @@ -18,7 +18,7 @@ export default class MiniStats {
if (params.miniStats === 'false') {
return;
}
if (typeof pc === 'undefined' || typeof pcx === 'undefined') {
if (typeof window.pc === 'undefined') {
return;
}
if (!app) {
Expand All @@ -30,7 +30,7 @@ export default class MiniStats {
}
if (state) {
if (!MiniStats.instance) {
MiniStats.instance = new pcx.MiniStats(app);
MiniStats.instance = new window.pc.MiniStats(app);
}
}
if (!MiniStats.instance) {
Expand Down
Loading