SlideShare a Scribd company logo
Marko Gorički
April 2019., APEX Alpe Adria
JavaScript in APEX
DO IT RIGHT!
• 10+ years working with APEX 🥰
• Presenter at HROUG, SIOUG, KSCOPE, APEX
World, APEX Alpe Adria, APEX Connect
• apex.world Member of the Year 2017.
• APEX related blog on apexbyg.blogspot.comMarko Gorički
Software Consultant@BiLog
@mgoricki
• Software development company
• Technology focus Oracle (APEX)
• APEX development, consulting,
educations, plugin development
• APEX solutions
• HR management software
• Reinsurance
All thoughts are mine…
How to use JavaScript in APEX?
#1
Use Dynamic
Actions whenever
possible
• “declarative” / low code
• relatively small footprint
• extensible
• implicit debugging
• reusable
• simple to use
#2
Too much of
anything is the
beginning of a
mess
• a lot of Dynamic Actions per page
• too much inline JavaScript
Dorothy Draper
#2
Too much of
anything is the
beginning of a
mess
• a lot of Dynamic Actions per page
• too much inline JavaScript
Dorothy Draper
More Dynamic Actions
=
Greater overall size of a page
=
Slower page rendering
+
Harder to manage them in Page
Designer
#2
Too much of
anything is the
beginning of a
mess
Dorothy Draper
• a lot of Dynamic Actions per page
• too much inline JavaScript
<script type="text/javascript">
function fHelloWorld(){
alert(‘Hello World’);
}
</script>
• internal/inline/embedded
<script src=“./external.js”></script>
• external
• internal/inline/embedded
• external
• internal/inline/embedded
• external
• Dynamic Actions
…generally in APEX…
..few minutes later..
Why inline JS is BAD?
•increases overall page size
•not reusable
•no minification
•no version control
•no error handling
•hard to maintain
•slower development
•no caching
#3
External
JavaScript is good
:)
• caching, file compression
• easier to maintain
• version control
• faster development time
• testing
• use of code/text editor
(IntelliSense)
• error handling
• minification
(1)Where to put static (JS) files?
(2)Where to reference them in APEX?
(3)How to write JS code?
(1)Where to put static (JS) files?
(2)Where to reference them in APEX?
(3)How to write JS code?
Mid Tier Browser / ClientDatabase / APEX
Mid Tier Browser / ClientDatabase / APEX
Custom Static Files
Mid Tier Browser / ClientDatabase / APEX
APEX Static Files
Custom Static Files
Mid Tier Browser / ClientDatabase / APEX
APEX Static Files
Web Server
Custom Static Files
Mid Tier Browser / ClientDatabase / APEX Web Server
Custom Static Files
APEX Static Files
over CDN
(1)Where to put static (JS) files?
(2)Where to reference them in APEX?
(3)How to write JS code?
Application
Shared Components > User Interfaces > User Interface
Details > JavaScript > File URLs
Theme Shared Components > Themes > Create > File URLs
Template Shared Components > Templates > JavaScript > File URLs
Plugin Shared Components > Plug-ins > Files
Page Page Designer > Page X > JavaScript > File URLs
Inline Using <script src=“#APP_IMAGES#external.js”></script>
(1)Where to put static (JS) files?
(2)Where to reference them in APEX?
(3)How to write JS code?
APEX JavaScript
API
APEX JavaScript
API
APEX JavaScript
API
APEX JavaScript
API
APEX JavaScript
API
APEX JavaScript
API
1 2 3
How I do it?
…is a tool that runs in the background watching for local static file
(e.g. JS, CSS) modifications, compiling them into a better format and
sending them back to your application instantly…
reduce development time
reduce repeating tasks
increase maintainability
better modularization
performance boost
enhanced teamwork
minification
concatenation
source mapping
error handling
easy file upload
browser synchronization
Source (SRC) folderFolder structure Distribution (DIST) folder
Source (SRC) folderFolder structure Distribution (DIST) folder
#5
Use JavaScript
Namespaces
• Namespace - container created to
hold a logical grouping
• Use them:
• to avoid naming collision
• not to pollute global namespace
• to organize code
Global Namespace
Stand-alone functions or variables
are polluting global namespace and
can lead to name collision
Global namespace should be
reserved for objects that have
system-wide relevance
function openModal(pDialogId, pDialogTriggerId, pSetFocusId, pClear ) {
$( "#" + pDialogId ).dialog("open");
}
theme42.js
aaapeks.custom.js
function openModal(pPageId){
var vUrl = apex.util.makeApplicationUrl({pageId:pPageId});
apex.navigation.openInNewWindow(vUrl);
};
020_aaapeks.js
/**
* APEX Alpe Adria Namespace
* @namespace aaapeks
*/
aaapeks = {};
/**
* APEX Alpe Adria Namespace
* @namespace aaapeks
*/
aaapeks = {};
(function(aaapeks) {
/* namespace code */
})(aaapeks);
Self-invoking function
020_aaapeks.js
/**
* APEX Alpe Adria Namespace
* @namespace aaapeks
*/
aaapeks = {};
(function(aaapeks) {
aaapeks.publicFunction = function(){
console.log('This is public function');
};
})(aaapeks);
020_aaapeks.js
Public function
* APEX Alpe Adria Namespace
* @namespace aaapeks
*/
var aaapeks = {};
(function(aaapeks) {
var vPrivate; // Private variable;
function privateFunction () {
console.log('Private function');
}
aaapeks.publicFunction = function(){
console.log('Public function');
privateFunction ();
};
})(aaapeks);
020_aaapeks.js
Private functions and variables
* APEX Alpe Adria Namespace
* @namespace aaapeks
*/
var aaapeks = {};
(function(aaapeks, debug, $) {
var vPrivate; // Private variable;
function privateFunction () {
debug.log('Private function');
}
aaapeks.publicFunction = function(){
debug.log('Public function');
privateFunction ();
};
})(aaapeks, apex.debug, apex.jQuery);
020_aaapeks.js
* APEX Alpe Adria Namespace
* @namespace aaapeks
*/
var aaapeks = {};
(function(aaapeks, debug, $) {
function log(){
Array.prototype.unshift.call(arguments, '020_aaapeks.js');
debug.log.apply(debug,arguments);
};
function privateFunction () {
log('privateFunction', arguments);
};
aaapeks.publicFunction = function(){
log('publicFunction', arguments);
privateFunction ();
};
})(aaapeks, apex.debug, apex.jQuery);
020_aaapeks.js
Private log function
#6
Document your code
with JSDoc
• documentation generator for
JavaScript
• using specific comments and tags
• integration with popular text editor
(function(aaapeks, debug, $) {
/**
* Private Log function, adds filename as a prefix
* @param {object} arguments - default arguments object
*/
function log(){
Array.prototype.unshift.call(arguments, '020_aaapeks.js');
debug.log.apply(debug,arguments);
};
/**
* Private Function
* @param {string} pParam1 - string parameter
* @private
*/
function privateFunction (pParam1) {
log('privateFunction', arguments);
apex.message.alert(pParam1);
};
/**
* Public function
* @param {string} pParam1 - string parameter
* @example
* aaapeks.publicFunction('This is a test');
#7
Hybrid Approach
Dynamic Actions
• use Dynamic Actions whenever is
possible
• call JS custom code from external
files
Presentation Take Away
• use Dynamic Actions whenever possible, but don’t overuse them
• put custom JavaScript in external files
• use APEX Nitro to gain many benefits
• modularize JS into Namespaces and separate files
• document your JS code with JSDoc
• use hybrid approach
Questions?
Thank You!

More Related Content

What's hot

Episerver and search engines
Episerver and search enginesEpiserver and search engines
Episerver and search engines
Mikko Huilaja
 
Json api dos and dont's
Json api dos and dont'sJson api dos and dont's
Json api dos and dont's
Neven Rakonić
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
Tony Tam
 
SOA on Rails
SOA on RailsSOA on Rails
SOA on Rails
Avi Flombaum
 
An Intense Overview of the React Ecosystem
An Intense Overview of the React EcosystemAn Intense Overview of the React Ecosystem
An Intense Overview of the React Ecosystem
Rami Sayar
 
APEX Wearables
APEX WearablesAPEX Wearables
APEX Wearables
Dimitri Gielis
 
Adobe AEM CQ5 - Developer Introduction
Adobe AEM CQ5 - Developer IntroductionAdobe AEM CQ5 - Developer Introduction
Adobe AEM CQ5 - Developer Introduction
Yash Mody
 
PLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring SurfPLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring Surf
Alfresco Software
 
Working with LoopBack Models
Working with LoopBack ModelsWorking with LoopBack Models
Working with LoopBack Models
Raymond Feng
 
Building a Node.js API backend with LoopBack in 5 Minutes
Building a Node.js API backend with LoopBack in 5 MinutesBuilding a Node.js API backend with LoopBack in 5 Minutes
Building a Node.js API backend with LoopBack in 5 Minutes
Raymond Feng
 
Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3
Wen-Tien Chang
 
RESTful Api practices Rails 3
RESTful Api practices Rails 3RESTful Api practices Rails 3
RESTful Api practices Rails 3
Anton Narusberg
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
Alfresco Software
 
A Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rbA Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rb
SmartLogic
 
Picking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use CasePicking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use Case
Jimmy Guerrero
 
LoopBack: a productivity booster for MEAN
LoopBack: a productivity booster for MEANLoopBack: a productivity booster for MEAN
LoopBack: a productivity booster for MEAN
Miroslav Bajtoš
 
How Shopify Scales Rails
How Shopify Scales RailsHow Shopify Scales Rails
How Shopify Scales Rails
jduff
 
Design for scale
Design for scaleDesign for scale
Design for scale
Doug Lampe
 
Design & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hoursDesign & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hours
Restlet
 
Web, Mobile, App and Back!
Web, Mobile, App and Back!Web, Mobile, App and Back!
Web, Mobile, App and Back!
Gabriel Walt
 

What's hot (20)

Episerver and search engines
Episerver and search enginesEpiserver and search engines
Episerver and search engines
 
Json api dos and dont's
Json api dos and dont'sJson api dos and dont's
Json api dos and dont's
 
Scaling with swagger
Scaling with swaggerScaling with swagger
Scaling with swagger
 
SOA on Rails
SOA on RailsSOA on Rails
SOA on Rails
 
An Intense Overview of the React Ecosystem
An Intense Overview of the React EcosystemAn Intense Overview of the React Ecosystem
An Intense Overview of the React Ecosystem
 
APEX Wearables
APEX WearablesAPEX Wearables
APEX Wearables
 
Adobe AEM CQ5 - Developer Introduction
Adobe AEM CQ5 - Developer IntroductionAdobe AEM CQ5 - Developer Introduction
Adobe AEM CQ5 - Developer Introduction
 
PLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring SurfPLAT-7 Spring Web Scripts and Spring Surf
PLAT-7 Spring Web Scripts and Spring Surf
 
Working with LoopBack Models
Working with LoopBack ModelsWorking with LoopBack Models
Working with LoopBack Models
 
Building a Node.js API backend with LoopBack in 5 Minutes
Building a Node.js API backend with LoopBack in 5 MinutesBuilding a Node.js API backend with LoopBack in 5 Minutes
Building a Node.js API backend with LoopBack in 5 Minutes
 
Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3
 
RESTful Api practices Rails 3
RESTful Api practices Rails 3RESTful Api practices Rails 3
RESTful Api practices Rails 3
 
PLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring SurfPLAT-8 Spring Web Scripts and Spring Surf
PLAT-8 Spring Web Scripts and Spring Surf
 
A Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rbA Practical Guide To Hypermedia APIs - Philly.rb
A Practical Guide To Hypermedia APIs - Philly.rb
 
Picking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use CasePicking the Right Node.js Framework for Your Use Case
Picking the Right Node.js Framework for Your Use Case
 
LoopBack: a productivity booster for MEAN
LoopBack: a productivity booster for MEANLoopBack: a productivity booster for MEAN
LoopBack: a productivity booster for MEAN
 
How Shopify Scales Rails
How Shopify Scales RailsHow Shopify Scales Rails
How Shopify Scales Rails
 
Design for scale
Design for scaleDesign for scale
Design for scale
 
Design & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hoursDesign & Deploy a data-driven Web API in 2 hours
Design & Deploy a data-driven Web API in 2 hours
 
Web, Mobile, App and Back!
Web, Mobile, App and Back!Web, Mobile, App and Back!
Web, Mobile, App and Back!
 

Similar to APEX Alpe Adria 2019 - JavaScript in APEX - do it right!

FOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDBFOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDB
ArangoDB Database
 
Isomorphic JS - new silver bullet
Isomorphic JS - new silver bulletIsomorphic JS - new silver bullet
Isomorphic JS - new silver bullet
imevs
 
Parse Apps with Ember.js
Parse Apps with Ember.jsParse Apps with Ember.js
Parse Apps with Ember.js
Matthew Beale
 
Oracle APEX & PhoneGap
Oracle APEX & PhoneGapOracle APEX & PhoneGap
Oracle APEX & PhoneGap
Christian Rokitta
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers
dssprakash
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyConsegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Fabio Akita
 
Always on! Or not?
Always on! Or not?Always on! Or not?
Always on! Or not?
Carsten Sandtner
 
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com RubyFisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
Fabio Akita
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
tdc-globalcode
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
Greg Whalin
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
Justin Cataldo
 
Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)
srigi
 
DSLs in JavaScript
DSLs in JavaScriptDSLs in JavaScript
DSLs in JavaScript
elliando dias
 
Refactor Large apps with Backbone
Refactor Large apps with BackboneRefactor Large apps with Backbone
Refactor Large apps with Backbone
devObjective
 
Refactor Large applications with Backbone
Refactor Large applications with BackboneRefactor Large applications with Backbone
Refactor Large applications with Backbone
ColdFusionConference
 
Refactoring Large Web Applications with Backbone.js
Refactoring Large Web Applications with Backbone.jsRefactoring Large Web Applications with Backbone.js
Refactoring Large Web Applications with Backbone.js
Stacy London
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Codemotion
 
Web Application Defences
Web Application DefencesWeb Application Defences
Web Application Defences
Damilola Longe, CISSP, CCSP, MSc
 
Os Haase
Os HaaseOs Haase
Os Haase
oscon2007
 
Death of a Themer
Death of a ThemerDeath of a Themer
Death of a Themer
James Panton
 

Similar to APEX Alpe Adria 2019 - JavaScript in APEX - do it right! (20)

FOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDBFOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDB
 
Isomorphic JS - new silver bullet
Isomorphic JS - new silver bulletIsomorphic JS - new silver bullet
Isomorphic JS - new silver bullet
 
Parse Apps with Ember.js
Parse Apps with Ember.jsParse Apps with Ember.js
Parse Apps with Ember.js
 
Oracle APEX & PhoneGap
Oracle APEX & PhoneGapOracle APEX & PhoneGap
Oracle APEX & PhoneGap
 
phonegap with angular js for freshers
phonegap with angular js for freshers    phonegap with angular js for freshers
phonegap with angular js for freshers
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyConsegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
 
Always on! Or not?
Always on! Or not?Always on! Or not?
Always on! Or not?
 
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com RubyFisl 11 - Dicas de Desenvolvimento Web com Ruby
Fisl 11 - Dicas de Desenvolvimento Web com Ruby
 
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
TDC2017 | Florianopolis - Trilha DevOps How we figured out we had a SRE team ...
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)Webpack & EcmaScript 6 (Webelement #32)
Webpack & EcmaScript 6 (Webelement #32)
 
DSLs in JavaScript
DSLs in JavaScriptDSLs in JavaScript
DSLs in JavaScript
 
Refactor Large apps with Backbone
Refactor Large apps with BackboneRefactor Large apps with Backbone
Refactor Large apps with Backbone
 
Refactor Large applications with Backbone
Refactor Large applications with BackboneRefactor Large applications with Backbone
Refactor Large applications with Backbone
 
Refactoring Large Web Applications with Backbone.js
Refactoring Large Web Applications with Backbone.jsRefactoring Large Web Applications with Backbone.js
Refactoring Large Web Applications with Backbone.js
 
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
Alberto Maria Angelo Paro - Isomorphic programming in Scala and WebDevelopmen...
 
Web Application Defences
Web Application DefencesWeb Application Defences
Web Application Defences
 
Os Haase
Os HaaseOs Haase
Os Haase
 
Death of a Themer
Death of a ThemerDeath of a Themer
Death of a Themer
 

Recently uploaded

Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
FODUU
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
danishmna97
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
Ivanti
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
Wouter Lemaire
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
Safe Software
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 

Recently uploaded (20)

Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Things to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUUThings to Consider When Choosing a Website Developer for your Website | FODUU
Things to Consider When Choosing a Website Developer for your Website | FODUU
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
How to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptxHow to Get CNIC Information System with Paksim Ga.pptx
How to Get CNIC Information System with Paksim Ga.pptx
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
June Patch Tuesday
June Patch TuesdayJune Patch Tuesday
June Patch Tuesday
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
UI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentationUI5 Controls simplified - UI5con2024 presentation
UI5 Controls simplified - UI5con2024 presentation
 
Essentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FMEEssentials of Automations: The Art of Triggers and Actions in FME
Essentials of Automations: The Art of Triggers and Actions in FME
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 

APEX Alpe Adria 2019 - JavaScript in APEX - do it right!

  • 1. Marko Gorički April 2019., APEX Alpe Adria JavaScript in APEX DO IT RIGHT!
  • 2. • 10+ years working with APEX 🥰 • Presenter at HROUG, SIOUG, KSCOPE, APEX World, APEX Alpe Adria, APEX Connect • apex.world Member of the Year 2017. • APEX related blog on apexbyg.blogspot.comMarko Gorički Software Consultant@BiLog @mgoricki
  • 3. • Software development company • Technology focus Oracle (APEX) • APEX development, consulting, educations, plugin development • APEX solutions • HR management software • Reinsurance
  • 5.
  • 6. How to use JavaScript in APEX?
  • 7.
  • 8.
  • 9. #1 Use Dynamic Actions whenever possible • “declarative” / low code • relatively small footprint • extensible • implicit debugging • reusable • simple to use
  • 10. #2 Too much of anything is the beginning of a mess • a lot of Dynamic Actions per page • too much inline JavaScript Dorothy Draper
  • 11. #2 Too much of anything is the beginning of a mess • a lot of Dynamic Actions per page • too much inline JavaScript Dorothy Draper
  • 12.
  • 13.
  • 14. More Dynamic Actions = Greater overall size of a page = Slower page rendering + Harder to manage them in Page Designer
  • 15. #2 Too much of anything is the beginning of a mess Dorothy Draper • a lot of Dynamic Actions per page • too much inline JavaScript
  • 16. <script type="text/javascript"> function fHelloWorld(){ alert(‘Hello World’); } </script> • internal/inline/embedded <script src=“./external.js”></script> • external
  • 19.
  • 20.
  • 21.
  • 22.
  • 24.
  • 25.
  • 27.
  • 28. Why inline JS is BAD? •increases overall page size •not reusable •no minification •no version control •no error handling •hard to maintain •slower development •no caching
  • 29. #3 External JavaScript is good :) • caching, file compression • easier to maintain • version control • faster development time • testing • use of code/text editor (IntelliSense) • error handling • minification
  • 30. (1)Where to put static (JS) files? (2)Where to reference them in APEX? (3)How to write JS code?
  • 31. (1)Where to put static (JS) files? (2)Where to reference them in APEX? (3)How to write JS code?
  • 32. Mid Tier Browser / ClientDatabase / APEX
  • 33. Mid Tier Browser / ClientDatabase / APEX Custom Static Files
  • 34. Mid Tier Browser / ClientDatabase / APEX APEX Static Files Custom Static Files
  • 35. Mid Tier Browser / ClientDatabase / APEX APEX Static Files Web Server Custom Static Files
  • 36. Mid Tier Browser / ClientDatabase / APEX Web Server Custom Static Files APEX Static Files over CDN
  • 37. (1)Where to put static (JS) files? (2)Where to reference them in APEX? (3)How to write JS code?
  • 38. Application Shared Components > User Interfaces > User Interface Details > JavaScript > File URLs Theme Shared Components > Themes > Create > File URLs Template Shared Components > Templates > JavaScript > File URLs Plugin Shared Components > Plug-ins > Files Page Page Designer > Page X > JavaScript > File URLs Inline Using <script src=“#APP_IMAGES#external.js”></script>
  • 39.
  • 40. (1)Where to put static (JS) files? (2)Where to reference them in APEX? (3)How to write JS code?
  • 46. How I do it?
  • 47.
  • 48. …is a tool that runs in the background watching for local static file (e.g. JS, CSS) modifications, compiling them into a better format and sending them back to your application instantly… reduce development time reduce repeating tasks increase maintainability better modularization performance boost enhanced teamwork minification concatenation source mapping error handling easy file upload browser synchronization
  • 49. Source (SRC) folderFolder structure Distribution (DIST) folder
  • 50. Source (SRC) folderFolder structure Distribution (DIST) folder
  • 51. #5 Use JavaScript Namespaces • Namespace - container created to hold a logical grouping • Use them: • to avoid naming collision • not to pollute global namespace • to organize code
  • 52. Global Namespace Stand-alone functions or variables are polluting global namespace and can lead to name collision Global namespace should be reserved for objects that have system-wide relevance function openModal(pDialogId, pDialogTriggerId, pSetFocusId, pClear ) { $( "#" + pDialogId ).dialog("open"); } theme42.js aaapeks.custom.js function openModal(pPageId){ var vUrl = apex.util.makeApplicationUrl({pageId:pPageId}); apex.navigation.openInNewWindow(vUrl); };
  • 53.
  • 54. 020_aaapeks.js /** * APEX Alpe Adria Namespace * @namespace aaapeks */ aaapeks = {};
  • 55. /** * APEX Alpe Adria Namespace * @namespace aaapeks */ aaapeks = {}; (function(aaapeks) { /* namespace code */ })(aaapeks); Self-invoking function 020_aaapeks.js
  • 56. /** * APEX Alpe Adria Namespace * @namespace aaapeks */ aaapeks = {}; (function(aaapeks) { aaapeks.publicFunction = function(){ console.log('This is public function'); }; })(aaapeks); 020_aaapeks.js Public function
  • 57. * APEX Alpe Adria Namespace * @namespace aaapeks */ var aaapeks = {}; (function(aaapeks) { var vPrivate; // Private variable; function privateFunction () { console.log('Private function'); } aaapeks.publicFunction = function(){ console.log('Public function'); privateFunction (); }; })(aaapeks); 020_aaapeks.js Private functions and variables
  • 58. * APEX Alpe Adria Namespace * @namespace aaapeks */ var aaapeks = {}; (function(aaapeks, debug, $) { var vPrivate; // Private variable; function privateFunction () { debug.log('Private function'); } aaapeks.publicFunction = function(){ debug.log('Public function'); privateFunction (); }; })(aaapeks, apex.debug, apex.jQuery); 020_aaapeks.js
  • 59. * APEX Alpe Adria Namespace * @namespace aaapeks */ var aaapeks = {}; (function(aaapeks, debug, $) { function log(){ Array.prototype.unshift.call(arguments, '020_aaapeks.js'); debug.log.apply(debug,arguments); }; function privateFunction () { log('privateFunction', arguments); }; aaapeks.publicFunction = function(){ log('publicFunction', arguments); privateFunction (); }; })(aaapeks, apex.debug, apex.jQuery); 020_aaapeks.js Private log function
  • 60. #6 Document your code with JSDoc • documentation generator for JavaScript • using specific comments and tags • integration with popular text editor
  • 61. (function(aaapeks, debug, $) { /** * Private Log function, adds filename as a prefix * @param {object} arguments - default arguments object */ function log(){ Array.prototype.unshift.call(arguments, '020_aaapeks.js'); debug.log.apply(debug,arguments); }; /** * Private Function * @param {string} pParam1 - string parameter * @private */ function privateFunction (pParam1) { log('privateFunction', arguments); apex.message.alert(pParam1); }; /** * Public function * @param {string} pParam1 - string parameter * @example * aaapeks.publicFunction('This is a test');
  • 62.
  • 63.
  • 64. #7 Hybrid Approach Dynamic Actions • use Dynamic Actions whenever is possible • call JS custom code from external files
  • 65.
  • 66. Presentation Take Away • use Dynamic Actions whenever possible, but don’t overuse them • put custom JavaScript in external files • use APEX Nitro to gain many benefits • modularize JS into Namespaces and separate files • document your JS code with JSDoc • use hybrid approach

Editor's Notes

  1. I will talk about how to do JavaScript in APEX and how to do it right at least as I thing it’s right
  2. as APEX we are also going into the dark mode, hope that this is right focused on consulting and business solution development very experienced in APEX migrations from Oracle Forms, Excel, ADF…
  3. everything I’m going to say today is based on my experience maybe this isn’t the best way… but it’s the way I do it, and for me, and for now, it’s the right way If you have some arguments against it, please let me know I would really like to hear them
  4. as I said I will talk about JS And the only book that I’ve read about JS is this…so! Seriously… don’t get me wrong with this presentation and start to write tons of JS in your APEX apps you really don’t need to be JavaScript Expert to create amazing stuff the time when you start to put custom code (JavaScript/CSS) in your APEX apps is the time when you start to be less productive my advise to you is - stick to the native and declarative stuff, as long as you can on long time basis thats the only way to go better to invest more time to data modeling and business logic than to some nice UX effects that will later on create you some problems with maintaining your apps
  5. but if you really need it, let’s see what’s the way to do it So let’s get back to the topic of the presentation and see how to use JS in APEX. - There are certainly some rules to follow. - I have a question for you: what’s the first thought that you thing of when somebody says APEX and JavaScript
  6. - I have one question for you - What’t the first thing that you can think of when somebody mentions APEX and JavaScript
  7. - it’s a result of the love between JS and APEX
  8. one of the rules that I really like to follow is… they enable us to create amazing APEX apps without knowing even a line of JavaScript DECLARATIVE - you don’t need to know a lot of JavaScript to do it in APEX it’s just few clicks away SMALL FOOTPRINT - that doesn’t effect page performance so much EXTENSIBLE - they are extensible with plugins and custom JS code IMPLICIT DEBUGGING REUSABLE - you can make them reusable by putting them to the global page SIMPLE TO USE - somebody that never saw the line of JS code can make nice UX they are good up to the some point until you start to use too much inline/embedded JS until you put too much DA on a single page
  9. dynamic actions can quickly become bad and ugly there are also some bad usage examples of JavaScript and the second dot there (too much inline JavaScript) is applicable to APEX globally, not only DA dynamic actions can quickly become bad and ugly two worst case scenarios are that you have too many DA per page too much inline JavaScript (that implies not only to the dynamic actions but generally about APEX)
  10. too many dynamic actions per page why is that bad?
  11. even if you go to the documentation and read about Dynamic Actions you can find one sentence
  12. - it says that you should be mindful of the fact that the more dynamic actions you add to a page, the greater your overall page size will be
  13. you will create something that’s really hard to maintain somebody will ask now - what’s the good limit? select application_id, page_id, count(1) from apex_application_page_da group by application_id, page_id order by 3 desc ;
  14. and the second thing that I’ve said I don’t like to see is too much inline JavaScript
  15. if we take a look at HTML and how you can write JS basically, there are 2 ways to do it Internal/inline/embedded is better to use embedded JS is for small code snippets are so small that it’s slower to make HTTP request to the server External: in all other cases it’s better to use external js file caching reusability smaller page why not to apply this rule to the APEX
  16. if we take a look at APEX you can do the same (put your code internally or externally) Ways to use JS in APEX declarative/low code (Dynamic Actions) embedded Dynamic Actions (Execute JS Code, Set Value, Client Side Condition) Page level (header, regions, properties...) Templates Plugins external - static files Instead of embedded JS you should always use Dynamic Actions
  17. if we take a look at APEX you can do the same (put your code internally or externally) declarative/low code (Dynamic Actions) embedded Dynamic Actions (Execute JS Code, Set Value, Client Side Condition) Page level (header, regions, properties...) Templates Plugins external - static files - here we should follow the same best practices as we do for PL/SQL - where you write your code outside of the APEX
  18. the reason why I’ve put “declarative” into quotes is because you can do custom JS there and Dynamic Actions are good until you start do to a lot of custom JS development in JavaScript Expression property
  19. you should avoid putting there large chunks of code same as you should avoid putting large chunks of PL/SQL to the processing pages
  20. Dynamic Actions (Execute JS Code, Set Value, Client Side Condition) Page level (header, regions, properties...) Templates Plugins I’ve seen it everywhrere: - in templates - plugins - event in PL/SQL procedure
  21. please don’t do this
  22. - napisati razloge zašto je JS loš
  23. if inline JS bad we must agree that external is good you don’t write your PL/SQL code in APEX
  24. now when we can agree that External JS files are good I have 3 more questions to answer
  25. now when we agreed that External JS files are good I have 3 more questions to answer
  26. this is standard APEX arhitecture on the left side we have DB and APEX in the middle ORDS deployed on Tomcat, Glassfish or Weblogic and on the right - browser/client
  27. Static Application Files and Static Workspace Files under the Shared Components there are 3 cases when I use them: 1) development env - because it’s faster to upload 2) small apps or apps with small number of users 3) when It’s really hard to get access to app server what I do for development and smaller apps is that I put static files to the APEX Application/Workspace Files I will show you later on why for development for smaller apps and for apps in some big companies is just pain in the ass to put something to web server where you have to include more than one person (DBA + Web Server Admin)
  28. you can also put them to the Mid tier where the ORDS is also, here are by default APEX static files in some cases it can be slow to put them there, especially if you don’t have direct access to that server
  29. but if you’re going for the performance and if you want best possible option - that’s to put them on Front End Server (where you can use all those benefits: file caching gzip compression - nginx - engine-x
  30. also, as a matter of APEX static files, from version 18.1 you can also use Oracle CDN maybe to free some resources over your servers
  31. now when we agreed that External JS files are good I have 3 more questions to answer
  32. there are several ways to reference them in APEX depending on what’s you’re doing if you use UT you can’t change theme or templates most of the time I use only one concatenated file, so I’m not putting any JS reference on the page level
  33. if I’m using Universal Theme - I’m putting my reference under the User Interface option when you go to the edit application #APPLICATION_JAVASCRIPT# and #APPLICATION_CSS#
  34. so how I do it… it’s really simple… (next slide) file location web server ORDS (application/workspace/theme files) file reference Nitro Config Hybrid DA
  35. there are several options to write JavaScript you can go for a Vanilla (plain) JavaScript, jQuery APEX API - build upon jQuery and it’s specific for APEX components or just Google some code and copy paste it to the JS
  36. there are several options to write JavaScript you can go for a Vanilla (plain) JavaScript, jQuery APEX API or just Google some code and copy paste it to the JS
  37. there are several options to write JavaScript you can go for a Vanilla (plain) JavaScript, jQuery APEX API or just Google some code and copy paste it to the JS
  38. there are several options to write JavaScript you can go for a Vanilla (plain) JavaScript, jQuery APEX API or just Google some code and copy paste it to the JS
  39. there are several options to write JavaScript you can go for a Vanilla (plain) JavaScript, jQuery APEX API or just Google some code and copy paste it to the JS
  40. in any project where I have to write a line of JavaScript or CSS I use APEX nitro - and what APEX nitro is…
  41. I won’t talk about the details, because I had presentation last year APEX Alpe Adria I will just make a quick overview the best definition that I came up with is… but that’s not all, Nitro will bring you a whole lot more left side - features right side - benefits the only prerequisite is to have Node and in APEX you need to put on Before Header process
  42. I won’t repeat myself about nitro because I’ve had presentation last year, so just quickly tool that enables you to work on static files (CSS, JS) locally runs in a backround watching for local file changes (CSS and JS) on every change it processes files and syncs them to the browser automatically runs in the background watching for local static file (CSS, JS modification) processes the files syncs the files to the browser automatically
  43. FEATURES in processing part you’ll get all different features error handling
  44. Benefits
  45. so, how it works 1) you locally create specific folder structure locally (with src and dist) as displayed on 1 2) and you put some files into this structure 3) Nitro magic happens there, and your files are transformed into some better format (besed on your projects configuration) only everything that’s inside JS and CSS folder is processed to the dist, everything else is just copied processed - it’s depended on your configuration: I always use minification and concatenation you need to write a lot of JS code so that your concatenated files would be very big
  46. the important thing is in the middle, that’s the way I structure my files you can see that I split files into meaningful modules, same as I do with the PL/SQL code in packages I do the same with CSS and PL/SQL most of the time I try to write things that are reusable so I put them in some general files if I have any of page specific JS I put it in separate files ORDER is important but from time to time I have something page specific. Everything like that I put into page specific files. same as I modularize my code into PL/SQL packages, I’m doing also with CSS and JS files
  47. - the feature of Nitro that I always use is concatenation (CSS and JS files)
  48. if we closely look at the slide that I’ve showed before you can see how I structure my files basically I split them in some meaningful modules, same as I do with PL/SQL code in packages most of the time I try to write things that are reusable so I put them in some general files but from time to time I have something page specific. Everything like that I put into page specific files. ORDER is important same as I modularize my code into PL/SQL packages, I’m doing also with CSS and JS files
  49. and what happens there is that I have only two file references in APEX app
  50. at the end I only have 2 files that are referenced from APEX CDN for static files file location - for development App Files, for prod Web Server - Theme Depended - only if working with custom theme - Custom CSS/JS into User Interface
  51. if we take a look back to my source folder you can see that I modularize my files as I said, same as my PL/SQL packages, into sam logical files lets look inside file
  52. first of all I use Namespaces Namespace - container created to hold a logical grouping like packages in PL/SQL they say that there’s no serious JS application without namespace Use them: to avoid collisions - to avoid collisions with other objects or variables in the global namespace/ minimize risk of code collision to organize blocks of functionalities into easily manageable groups and to make your code maintainable not to pollute global namespace (possible performance issues ) When you read about JS there are some best practices: Global namespace should be reserved for objects that have system-wide relevance and I try to avoid to use global variables and functions https://javascriptweblog.wordpress.com/2010/12/07/namespacing-in-javascript/ https://stackoverflow.com/questions/8862665/what-does-it-mean-global-namespace-would-be-polluted technically, JavaScript by default doesn’t provide namespaces by default Global variables should be reserved for objects that have system-wide relevance
  53. so if you create stand-alone function or variable you’re polluting global namespace window object is top object = global namespace window.apex => apex top object first of all I use namespaces Namespace container created to hold a logical grouping and to avoid collisions with other objects or variables in the global namespace it’s useful to organize blocks of functionalities into easily manageable groups and I try to avoid to use global variables and functions Global namespace should be reserved for objects that have system-wide relevance http://www.apexexplorer.com/how-to-show-and-hide-inline-dialog-in-oracle-apex-using-javascript/ function openModal(pUrl){window.open(pUrl);}
  54. so if you create stand-alone function or variable you’re polluting global namespace window object is top object = global namespace window.apex => apex top object first of all I use namespaces Namespace container created to hold a logical grouping and to avoid collisions with other objects or variables in the global namespace it’s useful to organize blocks of functionalities into easily manageable groups and I try to avoid to use global variables and functions Global namespace should be reserved for objects that have system-wide relevance http://www.apexexplorer.com/how-to-show-and-hide-inline-dialog-in-oracle-apex-using-javascript/ function openModal(pUrl){window.open(pUrl);}
  55. technically, JavaScript by default doesn’t provide namespaces by default, so we use objects the approach that I mostly use is Dynamic Namespacing - I think same as APEX development team 1) you create object (aaapex) - some logical content
  56. 2) then you create self-invoking function and you pass namespace object as an argument if there would be any name collision, you need only to change the name of the object and the argument
  57. 3) after that you can add some code to your namespace
  58. one of the benefits of this approach is that you can have also private functions and variables
  59. the next thing I like to add here is other namespaces/object
  60. next thing that I always add to my namespace is private log function similar to the logger for PL/SQL really helps in debugging pages with lots of JavaScript or Dynamic Actions and it’s really flexible, you don’t even need to add arguments
  61. what was missing there prerequisite: Node.js APEX dev team use it
  62. you need to put comments in specific format by using asterisks and slash
  63. declarative is under quotes because you can still write custom JS custom events - hooks they are event driven (browse, framework, component, custom) the more dynamic actions add to a page the greater your overall page size is they are good up to the some point until you start to use too much inline/embedded JS until you put too much DA on a single page
  64. možda je bolje da bude ovako malo bulleta declarative is under quotes because you can still write custom JS custom events - hooks they are event driven (browse, framework, component, custom) the more dynamic actions add to a page the greater your overall page size is they are good up to the some point until you start to use too much inline/embedded JS until you put too much DA on a single page
  65. primjer s hide(), show(), setValue(), getValue() zaključak poslije ovog slajda bi trebao biti da je bolje koristiti DA > APEX API
  66. - Namespace - namespace is simply a global object that contains a number of functions (top namespace object i apex with lots of sub namespaces like apex.item, apex.util… older non-namespaced APIs - start with charactes $ interfaces - functions that return objects that contain functions known as methods and variables (actions, item, model, region, htmlBuilder) widgets - UI Widgets +