File tree Expand file tree Collapse file tree 4 files changed +19
-9
lines changed Expand file tree Collapse file tree 4 files changed +19
-9
lines changed Original file line number Diff line number Diff line change 1
1
require ( 'globals' ) ;
2
- import { TNSXMLHttpRequest , FileReader , Blob } from './async/async' ;
3
- import { Element } from './DOM/Element' ;
4
- import { Document } from './DOM/Document' ;
2
+
3
+ if ( global . android && ! ( global as any ) . __canvasLoaded ) {
4
+ try {
5
+ // load canvas lib if polyfill is called before
6
+ java . lang . System . loadLibrary ( 'canvasnative' ) ;
7
+ ( global as any ) . __canvasLoaded = true ;
8
+ } catch ( e ) { }
9
+ }
10
+ import { TNSXMLHttpRequest , FileReader , Blob } from './async/async' ;
11
+ import { Element } from './DOM/Element' ;
12
+ import { Document } from './DOM/Document' ;
5
13
import './window' ;
6
14
import './resize' ;
7
15
import './process' ;
8
- import { TextDecoder , TextEncoder } from '@nativescript/canvas' ;
9
- import { URL } from './URL' ;
16
+ import { TextDecoder , TextEncoder } from '@nativescript/canvas' ;
17
+ import { URL } from './URL' ;
10
18
( global as any ) . document = ( global as any ) . window . document = ( global as any ) . document || new Document ( ) ;
11
19
Object . defineProperty ( global , 'Element' , {
12
20
value : Element ,
@@ -46,7 +54,6 @@ if (!((global as any).TextEncoder instanceof TextEncoder)) {
46
54
} ) ;
47
55
}
48
56
49
-
50
57
if ( ! ( ( global as any ) . URL instanceof URL ) ) {
51
58
Object . defineProperty ( global , 'URL' , {
52
59
value : URL ,
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ export class Canvas extends CanvasBase {
33
33
const activity =
34
34
Application . android . foregroundActivity || Application . android . startActivity ;
35
35
this . _canvas = new com . github . triniwiz . canvas . TNSCanvas ( activity , useCpu ) ;
36
+ ( global as any ) . __canvasLoaded = true ;
36
37
}
37
38
38
39
// @ts -ignore
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ export default {
2
+ install ( Vue ) {
3
+ Vue . registerElement ( 'Canvas' , ( ) => require ( '../' ) . Canvas ) ;
4
+ }
5
+ }
You can’t perform that action at this time.
0 commit comments