Last active
September 18, 2018 08:58
-
-
Save themasch/97122794f85a53447b49c2504699839d to your computer and use it in GitHub Desktop.
UI5 AMD shim?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function define (req, factory) { | |
if (typeof req === 'function') { | |
factory = req | |
req = [] | |
} | |
return sap.ui.define(req, factory, true) | |
} | |
define.amd = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<title>example</title> | |
<script id="sap-ui-bootstrap" | |
src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" | |
data-sap-ui-libs="sap.m" | |
data-sap-ui-theme="sap_belize" | |
data-sap-ui-compatVersion="edge" | |
data-sap-ui-preload="async" | |
data-sap-ui-logLevel="INFO" | |
data-sap-ui-resourceroots='{ | |
"npm": "./node_modules/" | |
}'> | |
</script> | |
<script> | |
function define (req, factory) { | |
if (typeof req === 'function') { | |
factory = req | |
req = [] | |
} | |
return sap.ui.define(req, factory, true) | |
} | |
define.amd = true | |
</script> | |
<script> | |
sap.ui.getCore().attachInit(function () { | |
sap.ui.require(['sap/m/Button', 'npm/downloadjs/download'], function (Button, download) { | |
const press = () => download('Hello World', 'hello_world.txt', 'text/plain') | |
new Button({ text: 'hi!', press }).placeAt('content') | |
}) | |
}) | |
</script> | |
</head> | |
<body class="sapUiBody" id="content"> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment