All files / src/Ice CompositeSliceLoader.js

85.71% Statements 18/21
83.33% Branches 5/6
66.66% Functions 2/3
85.71% Lines 18/21

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 2241x 41x 41x 41x 2x 2x 41x 41x     41x 41x 110x 188x 188x 110x 110x 188x   110x 41x  
// Copyright (c) ZeroC, Inc.
 
export class CompositeSliceLoader {
    constructor(sliceLoaders = []) {
        this.sliceLoaders = sliceLoaders;
    }
 
    add(loader) {
        this.sliceLoaders.push(loader);
    }
 
    newInstance(typeId) {
        for (const loader of this.sliceLoaders) {
            let instance = loader.newInstance(typeId);
            if (instance !== null) {
                return instance;
            }
        }
        return null;
    }
}