Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

331
Visualizações
Implementing the IAsyncContentCreation interface in UI5

To ensure sap.ui.core.UIComponent to be created fully asynchronously, we need to implement the IAsyncContentCreation interface:

metadata: {
    interfaces: [
        "sap.ui.core.IAsyncContentCreation"
    ],
    manifest: "json"
}

That's totally OK.
Exploring the SAP apps samples, I've found out the following code snippet, where the hard-coded and, thus error prone, interface name is replaced with code, which can be automatically checked:

sap.ui.define([
    "sap/ui/core/library",
    "sap/ui/core/UIComponent",
    …
], function(library, UIComponent, models, History) {
    "use strict";

    return UIComponent.extend("sap.ui.demo.toolpageapp.Component", {

        metadata: {
            interfaces: [
                library.IAsyncContentCreation
            ],
            manifest: "json"
        }
        …

    }
}

I've tried to check the content of library in DevTools, but I get a ReferenceError exception instead of the library's values:

Uncaught ReferenceError: library is not defined
    at eval (eval at init (Component.js:24), <anonymous>:1:1)
    at f.init (Component.js:24)
    at sap-ui-core.js:315
    at f.constructor (sap-ui-core.js:315)
    at f.constructor (sap-ui-core.js:585)
    at f.constructor (library-preload.js:1154)
    at f [as constructor] (sap-ui-core.js:547)
    at new o1 (sap-ui-core.js:632)
    at H (sap-ui-core.js:628)
    at sap-ui-core.js:628

How can I ensure that library.IAsyncContentCreation is really properly defined and returns "sap.ui.core.IAsyncContentCreation" as intended?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I've tried to check the content of library in DevTools, but I get a ReferenceError exception.

Most probably, you've encountered the V8's debugger limitation, where the unused closure variables (here: library) are not evaluated by the V8 during the debugger session, and thus not accessible from the devtool console. See Why does Chrome debugger think closed local variable is undefined? and also the V8 issues #3491 and #2710.

The above limitation applies only to V8's debugger. When the code is executed at runtime, library.IAsyncContentCreation will be resolved to the string "sap.ui.core.IAsyncContentCreation" as expected so you won't get the ReferenceError.

Exploring the SAP apps samples, [...] interface name is replaced with code.

It's unclear why the sample author decided to require the core library in the first place. Those interfaces in UI5 Objects await string literals. And UI5 interfaces are simple marker interfaces (aka. tagging interfaces). They don't specify any behavior in code. Adding the interface name (string literal) simply tells how the class implementing the interface is supposed to behave. So adding the string literal is sufficient.

interfaces: [
  "sap.ui.core.IAsyncContentCreation"
],
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda