1 |
|
2 |
|
3 |
|
4 |
|
5 | var LoaderUtils = {
|
6 |
|
7 | decodeText: function ( array ) {
|
8 |
|
9 | if ( typeof TextDecoder !== 'undefined' ) {
|
10 |
|
11 | return new TextDecoder().decode( array );
|
12 |
|
13 | }
|
14 |
|
15 |
|
16 |
|
17 |
|
18 | var s = '';
|
19 |
|
20 | for ( var i = 0, il = array.length; i < il; i ++ ) {
|
21 |
|
22 |
|
23 | s += String.fromCharCode( array[ i ] );
|
24 |
|
25 | }
|
26 |
|
27 |
|
28 | return decodeURIComponent( escape( s ) );
|
29 |
|
30 | },
|
31 |
|
32 | extractUrlBase: function ( url ) {
|
33 |
|
34 | var index = url.lastIndexOf( '/' );
|
35 |
|
36 | if ( index === - 1 ) return './';
|
37 |
|
38 | return url.substr( 0, index + 1 );
|
39 |
|
40 | }
|
41 |
|
42 | };
|
43 |
|
44 | export { LoaderUtils };
|