Skip to content

Commit

Permalink
Merge pull request #515 from GrimoireGL/fix/readme
Browse files Browse the repository at this point in the history
fix: add library-loading event to handle by message event on window
  • Loading branch information
kyasbal authored Aug 12, 2017
2 parents 6062b6b + 5fdc8bc commit 14bc599
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Base/AttributeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {Name, Undef} from "./Types";

type NameValPair<T> = { fqn: string, val: T };

class AttributeBuffer<T>{
class AttributeBuffer<T> {

private _fqnList: NameValPair<T>[] = [];

Expand Down
8 changes: 8 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class GrimoireInitializer {
*/
public static async initialize(): Promise<void> {
try {
GrimoireInitializer._notifyLibraryLoadingToWindow();
GrimoireInitializer._copyGLConstants();
GrimoireInterface.initialize();
await GrimoireInitializer._waitForDOMLoading();
Expand Down Expand Up @@ -69,6 +70,13 @@ class GrimoireInitializer {
log += `\nTo suppress this message,please inject a line "gr.debug = false;" on the initializing timing.`;
console.log(log, "color:#44F;font-weight:bold;");
}

private static _notifyLibraryLoadingToWindow(): void {
window.postMessage({
$source: "grimoirejs",
$messageType: "library-loading"
}, "*");
}
}

/**
Expand Down

0 comments on commit 14bc599

Please sign in to comment.