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

Ayncnode comments cleanup #385

Merged
merged 1 commit into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 0 additions & 1 deletion plugins/async-node/core/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ test("replaces async nodes with provided node", async () => {
let deferredResolve: ((value: any) => void) | undefined;

plugin.hooks.onAsyncNode.tap("test", async (node: Node.Node) => {
console.log("tapped");
return new Promise((resolve) => {
deferredResolve = resolve;
});
Expand Down
13 changes: 0 additions & 13 deletions plugins/async-node/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ export class AsyncNodePlugin implements PlayerPlugin {
this.plugins = options.plugins;
options.plugins.forEach((plugin) => {
plugin.applyPlugin(this);
// plugin.asyncNode.tap('test', async (node: Node.Node) => {
// console.log('got async node')
// return await this.hooks.onAsyncNode.call(node)
// });
});
}
}
Expand Down Expand Up @@ -131,11 +127,7 @@ export class AsyncNodePluginPlugin implements AsyncNodeViewPlugin {
const newNode = resolvedNode || node;
if (!resolvedNode && node?.type === NodeType.Async) {
queueMicrotask(async () => {
if (this.basePlugin) {
console.log("calling async node");
}
const result = await this.basePlugin?.hooks.onAsyncNode.call(node);
console.log(`result is ${result}`);
const parsedNode =
options.parseNode && result ? options.parseNode(result) : undefined;

Expand All @@ -154,7 +146,6 @@ export class AsyncNodePluginPlugin implements AsyncNodeViewPlugin {

apply(view: ViewInstance): void {
view.hooks.parser.tap("template", this.applyParser.bind(this));
console.log(`wtf ${this.basePlugin}`);
view.hooks.resolver.tap("template", (resolver) => {
resolver.hooks.beforeResolve.tap(this.name, (node, options) => {
let resolvedNode;
Expand All @@ -170,11 +161,7 @@ export class AsyncNodePluginPlugin implements AsyncNodeViewPlugin {
const newNode = resolvedNode || node;
if (!resolvedNode && node?.type === NodeType.Async) {
queueMicrotask(async () => {
if (this.basePlugin) {
console.log("calling async node");
}
const result = await this.basePlugin?.hooks.onAsyncNode.call(node);
console.log(`result is ${result}`);
const parsedNode =
options.parseNode && result
? options.parseNode(result)
Expand Down