add ResourceLoader plugin
This commit is contained in:
@@ -4203,6 +4203,14 @@ function keyboard(context) {
|
||||
};
|
||||
}
|
||||
|
||||
function resourceLoader(context) {
|
||||
return {
|
||||
load: function (resource) {
|
||||
return context.callNative('resourceLoader', 'load', resource.toModel());
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
var __values = (undefined && undefined.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) { return m.call(o); }
|
||||
@@ -4628,6 +4636,7 @@ exports.popover = popover;
|
||||
exports.pullable = pullable;
|
||||
exports.refreshable = refreshable;
|
||||
exports.repeat = repeat;
|
||||
exports.resourceLoader = resourceLoader;
|
||||
exports.scroller = scroller;
|
||||
exports.slideItem = slideItem;
|
||||
exports.slider = slider;
|
||||
|
@@ -3222,6 +3222,14 @@ function keyboard(context) {
|
||||
};
|
||||
}
|
||||
|
||||
function resourceLoader(context) {
|
||||
return {
|
||||
load: (resource) => {
|
||||
return context.callNative('resourceLoader', 'load', resource.toModel());
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
class Observable {
|
||||
constructor(provider, clz) {
|
||||
this.observers = new Set;
|
||||
@@ -3559,6 +3567,7 @@ exports.popover = popover;
|
||||
exports.pullable = pullable;
|
||||
exports.refreshable = refreshable;
|
||||
exports.repeat = repeat;
|
||||
exports.resourceLoader = resourceLoader;
|
||||
exports.scroller = scroller;
|
||||
exports.slideItem = slideItem;
|
||||
exports.slider = slider;
|
||||
|
@@ -4750,6 +4750,14 @@ function keyboard(context) {
|
||||
};
|
||||
}
|
||||
|
||||
function resourceLoader(context) {
|
||||
return {
|
||||
load: (resource) => {
|
||||
return context.callNative('resourceLoader', 'load', resource.toModel());
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
class Observable {
|
||||
constructor(provider, clz) {
|
||||
this.observers = new Set;
|
||||
@@ -5328,6 +5336,7 @@ exports.popover = popover;
|
||||
exports.pullable = pullable;
|
||||
exports.refreshable = refreshable;
|
||||
exports.repeat = repeat;
|
||||
exports.resourceLoader = resourceLoader;
|
||||
exports.scroller = scroller;
|
||||
exports.slideItem = slideItem;
|
||||
exports.slider = slider;
|
||||
|
9
doric-js/index.d.ts
vendored
9
doric-js/index.d.ts
vendored
@@ -112,6 +112,7 @@ declare module 'doric/lib/src/native/index.native' {
|
||||
export * from 'doric/lib/src/native/coordinator';
|
||||
export * from 'doric/lib/src/native/notch';
|
||||
export * from 'doric/lib/src/native/keyboard';
|
||||
export * from 'doric/lib/src/native/resourceLoader';
|
||||
}
|
||||
|
||||
declare module 'doric/lib/src/util/index.util' {
|
||||
@@ -1344,6 +1345,14 @@ declare module 'doric/lib/src/native/keyboard' {
|
||||
};
|
||||
}
|
||||
|
||||
declare module 'doric/lib/src/native/resourceLoader' {
|
||||
import { Resource } from "doric/lib/src/util/resource";
|
||||
import { BridgeContext } from "doric/lib/src/runtime/global";
|
||||
export function resourceLoader(context: BridgeContext): {
|
||||
load: (resource: Resource) => Promise<ArrayBuffer>;
|
||||
};
|
||||
}
|
||||
|
||||
declare module 'doric/lib/src/util/color' {
|
||||
import { Modeling } from "doric/lib/src/util/types";
|
||||
/**
|
||||
|
6
doric-js/lib/src/native/imageDecoder.d.ts
vendored
Normal file
6
doric-js/lib/src/native/imageDecoder.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Resource } from "../util/resource";
|
||||
import { BridgeContext } from "../runtime/global";
|
||||
export declare function imageDecoder(context: BridgeContext): {
|
||||
getBitmapInfo: (resource: Resource) => Promise<ArrayBuffer>;
|
||||
decodeToPixels: (resource: Resource) => Promise<ArrayBuffer>;
|
||||
};
|
25
doric-js/lib/src/native/imageDecoder.js
Normal file
25
doric-js/lib/src/native/imageDecoder.js
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright [2021] [Doric.Pub]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export function imageDecoder(context) {
|
||||
return {
|
||||
getBitmapInfo: (resource) => {
|
||||
return context.callNative('imageDecoder', 'getBitmapInfo', resource);
|
||||
},
|
||||
decodeToPixels: (resource) => {
|
||||
return context.callNative('imageDecoder', 'decode', resource);
|
||||
},
|
||||
};
|
||||
}
|
1
doric-js/lib/src/native/index.native.d.ts
vendored
1
doric-js/lib/src/native/index.native.d.ts
vendored
@@ -10,3 +10,4 @@ export * from './statusbar';
|
||||
export * from './coordinator';
|
||||
export * from './notch';
|
||||
export * from './keyboard';
|
||||
export * from './resourceLoader';
|
||||
|
@@ -25,3 +25,4 @@ export * from './statusbar';
|
||||
export * from './coordinator';
|
||||
export * from './notch';
|
||||
export * from './keyboard';
|
||||
export * from './resourceLoader';
|
||||
|
5
doric-js/lib/src/native/resourceLoader.d.ts
vendored
Normal file
5
doric-js/lib/src/native/resourceLoader.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { Resource } from "../util/resource";
|
||||
import { BridgeContext } from "../runtime/global";
|
||||
export declare function resourceLoader(context: BridgeContext): {
|
||||
load: (resource: Resource) => Promise<ArrayBuffer>;
|
||||
};
|
7
doric-js/lib/src/native/resourceLoader.js
Normal file
7
doric-js/lib/src/native/resourceLoader.js
Normal file
@@ -0,0 +1,7 @@
|
||||
export function resourceLoader(context) {
|
||||
return {
|
||||
load: (resource) => {
|
||||
return context.callNative('resourceLoader', 'load', resource.toModel());
|
||||
},
|
||||
};
|
||||
}
|
29
doric-js/src/native/imageDecoder.ts
Normal file
29
doric-js/src/native/imageDecoder.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright [2021] [Doric.Pub]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Resource } from "../util/resource"
|
||||
import { BridgeContext } from "../runtime/global"
|
||||
|
||||
export function imageDecoder(context: BridgeContext) {
|
||||
return {
|
||||
getBitmapInfo: (resource: Resource) => {
|
||||
return context.callNative('imageDecoder', 'getBitmapInfo', resource) as Promise<ArrayBuffer>
|
||||
},
|
||||
decodeToPixels: (resource: Resource) => {
|
||||
return context.callNative('imageDecoder', 'decode', resource) as Promise<ArrayBuffer>
|
||||
},
|
||||
}
|
||||
}
|
@@ -24,4 +24,5 @@ export * from './notification'
|
||||
export * from './statusbar'
|
||||
export * from './coordinator'
|
||||
export * from './notch'
|
||||
export * from './keyboard'
|
||||
export * from './keyboard'
|
||||
export * from './resourceLoader'
|
25
doric-js/src/native/resourceLoader.ts
Normal file
25
doric-js/src/native/resourceLoader.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright [2021] [Doric.Pub]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Resource } from "../util/resource"
|
||||
import { BridgeContext } from "../runtime/global"
|
||||
|
||||
export function resourceLoader(context: BridgeContext) {
|
||||
return {
|
||||
load: (resource: Resource) => {
|
||||
return context.callNative('resourceLoader', 'load', resource.toModel()) as Promise<ArrayBuffer>;
|
||||
},
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user