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
const marked = requireModule('marked'); | |
// library-specific options | |
marked.setOptions({ | |
headerIds: false | |
}); | |
apex.env.P5_HTML = marked(apex.env.P5_MARKDOWN); |
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
// calling our custom requireModule function | |
const qrcode = requireModule('qrcode'); | |
// library specific options | |
const code = qrcode(4, 'L'); | |
code.addData(apex.env.P1_QR_DATA); | |
code.make(); | |
// saving the base64 result into a page item of type Display Image | |
apex.env.P1_QR_CODE = code.createDataURL(4); |
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
// fetch the library from the table | |
const loadFromDatabase = (moduleName) => { | |
const result = apex.conn.execute(` | |
select source | |
from javascript_modules | |
where module_name = :name | |
`, { | |
name: moduleName |
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
declare | |
type module_t is table of varchar2(100) index by varchar2(100); | |
l_modules module_t := module_t(); | |
l_module varchar2(100); | |
l_code clob; | |
begin | |
/* store the name and location of each library that is to be imported */ | |
l_modules('qrcode') := 'https://cdnjs.cloudflare.com/ajax/libs/qrcode-generator/1.4.4/qrcode.min.js'; | |
l_modules('validator') := 'https://cdnjs.cloudflare.com/ajax/libs/validator/13.5.2/validator.min.js'; | |
l_modules('marked') := 'https://cdnjs.cloudflare.com/ajax/libs/marked/1.2.9/marked.min.js'; |
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
create table javascript_modules | |
( module_name varchar2(100) primary key not null | |
, source clob not null | |
); |
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
console.log(variable1); // error: variable1 is not defined | |
console.log(globalThis.variable1); // undefined | |
console.log(globalThis.variable2); // 200 |
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
let variable1 = 100; | |
globalThis.variable2 = 200; |
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
/* | |
In case the browser asynchronously called the server via AJAX, | |
this is how we can handle that request in JavaScript (MLE) | |
*/ | |
let response = {}; | |
try { | |
// execute any business logic here | |
apex.conn.execute(…); | |
// dummy response |
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
// getting page item values | |
const empno = apex.env.P1_ID; | |
const salary = apex.env.P1_SAL; | |
// executing DML operations | |
apex.conn.execute('update emp set sal = :sal where empno = :empno', { | |
sal: salary, | |
empno: empno | |
}); |
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
// followup to this conversation https://stefandobre.com/a-closer-look-at-the-rich-text-editor-of-orclapex-20-2/ | |
function(options) { | |
options.editorOptions.toolbar = { | |
items:[ | |
'heading', | |
'|', 'code', 'codeBlock', 'blockQuote', | |
'|', 'bold', 'italic', 'underline', 'strikethrough', 'fontfamily', 'fontsize', 'RemoveFormat', 'link', | |
'|', 'numberedList', 'bulletedList', 'outdent', 'indent', 'Alignment', | |
'|', 'InsertTable', 'fontColor', 'fontBackgroundColor', | |
'|', 'PageBreak', 'HorizontalLine', 'todoList', 'undo', 'redo' |
NewerOlder