Skip to content
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
2 changes: 1 addition & 1 deletion packages/canvas-media/video/index.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export class Video extends VideoBase {
getCurrentFrame(context?: WebGLRenderingContext) {
const ctx = arguments[1] as any;
const flipY = ctx._flipY;
const ptr = ctx._canvas._canvas.getNativeGL();
const ptr = ctx._canvas._canvas.getNativeContext();

this._instance.getCurrentFrame(!!this.isLoaded, ptr, flipY, arguments[4], arguments[5]);
}
Expand Down
10 changes: 9 additions & 1 deletion packages/canvas-polyfill/DOM/EventTarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ export class EventTarget {
}
}

dispatchEvent(event) {
/**
* Dispatches an event to this EventTarget.
* https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/dispatchEvent
* @param event
* @returns false if event is cancelable, and at least one of the event handlers which received event called Event.preventDefault(). Otherwise true.
*/
dispatchEvent(event): boolean {
let emitter: Observable;

if (global.isAndroid) {
Expand All @@ -63,5 +69,7 @@ export class EventTarget {
if (emitter !== null && emitter !== undefined) {
emitter.notify({ ...event, eventName: event.type, object: emitter });
}

return !event?.defaultPrevented;
}
}
2 changes: 1 addition & 1 deletion packages/canvas-polyfill/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require('globals');
require('@nativescript/core/globals');

if (__ANDROID__ && !(global as any).__canvasLoaded) {
try {
Expand Down
9 changes: 9 additions & 0 deletions packages/canvas/Canvas/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ export class Event {
}
}

export class CustomEvent extends Event {
detail: any;

constructor(type: string, options?: EventOptions & { detail?: any }) {
super(type, options);
this.detail = options?.detail ?? null;
}
}

interface UIEventOptions extends EventOptions {
detail?: number;
view?: any;
Expand Down
Loading