How to use the ariatemplates/core/ResMgr.loadResource function in ariatemplates

To help you get started, we’ve selected a few ariatemplates examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ariatemplates / ariatemplates / test / aria / core / ResMgr2TestCase.js View on Github external
testAsyncCase1 : function () {
            var self = this;
            ariaCoreResMgr.currentLocale = "fr_FR";
            this.beginDownloadMgrMock([{
                logicalPath : "test/aria/core/testResMgr/MyRes1_fr_FR.js",
                content : "Aria.resourcesDefinition({$classpath: 'test.aria.core.testResMgr.MyRes1', $resources: {value:'testAsyncCase1'}})"
            }]);
            ariaCoreResMgr.loadResource(null, "test/aria/core/testResMgr/MyRes1").then(function (res) {
                self.assertEquals(res.value, "testAsyncCase1");
                self.assertEquals(res, Aria.$global.test.aria.core.testResMgr.MyRes1);
                var locale = aria.core.ResMgr.getResourceLocale("test.aria.core.testResMgr.MyRes1");
                self.assertEquals(locale, "fr_FR");
                Aria.dispose(res);
                self.notifyTestEnd();
            }, this.handleAsyncTestError);
        },
github ariatemplates / ariatemplates / test / aria / core / ResMgr2TestCase.js View on Github external
ariaModulesRequestMgr._params = null;
            ariaCoreAppEnvironment.setEnvironment({
                urlService : {
                    implementation : "aria.modules.urlService.PatternURLCreationImpl",
                    args : [null, "http://www.ariatemplates.com:8080/xyz/${moduleName}/sampleResId?locale=${locale}"]
                }
            }, null, true);
            ariaCoreResMgr.currentLocale = "fr_FR";
            this.beginDownloadMgrMock([{
                logicalPath : "test/aria/core/testResMgr/MyRes6_fr_FR.js",
                content : "Aria.resourcesDefinition({$classpath: 'test.aria.core.testResMgr.MyRes6', $resources: {value:'testAsyncCase6'}})",
                args : {
                    fullLogicalPath : "http://www.ariatemplates.com:8080/xyz/myModule6/sampleResId?locale=fr_FR"
                }
            }]);
            ariaCoreResMgr.loadResource("myModule6", "test/aria/core/testResMgr/MyRes6").then(function (res) {
                self.assertEquals(res.value, "testAsyncCase6");
                self.assertEquals(res, Aria.$global.test.aria.core.testResMgr.MyRes6);
                var locale = aria.core.ResMgr.getResourceLocale("test.aria.core.testResMgr.MyRes6");
                self.assertEquals(locale, "fr_FR");
                Aria.dispose(res);
                self.notifyTestEnd();
            }, this.handleAsyncTestError);
        },
github ariatemplates / ariatemplates / test / aria / core / ResMgr2TestCase.js View on Github external
testAsyncCase5 : function () {
            var self = this;
            ariaCoreEnvironment.setDevMode(true);
            ariaCoreResMgr.currentLocale = "fr_FR";
            this.beginDownloadMgrMock([{
                logicalPath : "test/aria/core/testResMgr/MyRes5.js",
                content : "Aria.resourcesDefinition({$classpath: 'test.aria.core.testResMgr.MyRes5', $resources: {value:'testAsyncCase5'}})"
            }]);
            ariaCoreResMgr.loadResource("myModule5", "test/aria/core/testResMgr/MyRes5").then(function (res) {
                self.assertEquals(res.value, "testAsyncCase5");
                self.assertEquals(res, Aria.$global.test.aria.core.testResMgr.MyRes5);
                var locale = aria.core.ResMgr.getResourceLocale("test.aria.core.testResMgr.MyRes5");
                self.assertEquals(locale, "fr_FR");
                Aria.dispose(res);
                self.notifyTestEnd();
            }, this.handleAsyncTestError);
        },
github ariatemplates / ariatemplates / test / aria / core / ResMgr2TestCase.js View on Github external
testAsyncCase3 : function () {
            var self = this;
            ariaCoreResMgr.currentLocale = "fr_FR";
            this.beginDownloadMgrMock([{
                        logicalPath : "test/aria/core/testResMgr/MyRes3_fr_FR.js"
                    }, {
                        logicalPath : "test/aria/core/testResMgr/MyRes3_fr.js"
                    }, {
                        logicalPath : "test/aria/core/testResMgr/MyRes3.js",
                        content : "Aria.resourcesDefinition({$classpath: 'test.aria.core.testResMgr.MyRes3', $resources: {value:'testAsyncCase3'}})"
                    }]);
            ariaCoreResMgr.loadResource(null, "test/aria/core/testResMgr/MyRes3").then(function (res) {
                self.assertEquals(res.value, "testAsyncCase3");
                self.assertEquals(res, Aria.$global.test.aria.core.testResMgr.MyRes3);
                var locale = aria.core.ResMgr.getResourceLocale("test.aria.core.testResMgr.MyRes3");
                self.assertEquals(locale, "");
                Aria.dispose(res);
                self.notifyTestEnd();
            }, this.handleAsyncTestError);
        },
github ariatemplates / ariatemplates / test / aria / core / ResMgr2TestCase.js View on Github external
testAsyncCase7 : function () {
            var self = this;
            ariaCoreEnvironment.setDevMode(true);
            ariaCoreResMgr.currentLocale = "fr_FR";
            this.beginDownloadMgrMock([{
                        logicalPath : "test/aria/core/testResMgr/MyRes7.js"
                    }]);
            ariaCoreResMgr.loadResource("myModule7", "test/aria/core/testResMgr/MyRes7").then(function (res) {
                try {
                    self.fail("Loading MyRes7 should not succeed.");
                } catch (e) {
                    self.handleAsyncTestError(e);
                }
            }, function (error) {
                self.assertEquals(Aria.getClassRef("test.aria.core.testResMgr.MyRes7"), null);
                ariaCoreResMgr.unloadResource("test/aria/core/testResMgr/MyRes7");
                self.notifyTestEnd();
            });
        },
github ariatemplates / ariatemplates / test / aria / core / ResMgr2TestCase.js View on Github external
testAsyncCase2 : function () {
            var self = this;
            ariaCoreResMgr.currentLocale = "fr_FR";
            this.beginDownloadMgrMock([{
                        logicalPath : "test/aria/core/testResMgr/MyRes2_fr_FR.js"
                    }, {
                        logicalPath : "test/aria/core/testResMgr/MyRes2_fr.js",
                        content : "Aria.resourcesDefinition({$classpath: 'test.aria.core.testResMgr.MyRes2', $resources: {value:'testAsyncCase2'}})"
                    }]);
            ariaCoreResMgr.loadResource(null, "test/aria/core/testResMgr/MyRes2").then(function (res) {
                self.assertEquals(res.value, "testAsyncCase2");
                self.assertEquals(res, Aria.$global.test.aria.core.testResMgr.MyRes2);
                var locale = aria.core.ResMgr.getResourceLocale("test.aria.core.testResMgr.MyRes2");
                self.assertEquals(locale, "fr");
                Aria.dispose(res);
                self.notifyTestEnd();
            }, this.handleAsyncTestError);
        },
github ariatemplates / ariatemplates / test / aria / core / ResMgr2TestCase.js View on Github external
ariaCoreEnvironment.setDevMode(false);
            ariaModulesRequestMgr._params = null;
            ariaCoreAppEnvironment.setEnvironment({
                urlService : {
                    implementation : "aria.modules.urlService.PatternURLCreationImpl",
                    args : [null, "http://www.ariatemplates.com:8080/xyz/${moduleName}/sampleResId?locale=${locale}"]
                }
            }, null, true);
            ariaCoreResMgr.currentLocale = "fr_FR";
            this.beginDownloadMgrMock([{
                        logicalPath : "test/aria/core/testResMgr/MyRes8_fr_FR.js",
                        args : {
                            fullLogicalPath : "http://www.ariatemplates.com:8080/xyz/myModule8/sampleResId?locale=fr_FR"
                        }
                    }]);
            ariaCoreResMgr.loadResource("myModule8", "test/aria/core/testResMgr/MyRes8").then(function (res) {
                try {
                    self.fail("Loading MyRes8 should not succeed.");
                } catch (e) {
                    self.handleAsyncTestError(e);
                }
            }, function (error) {
                self.assertEquals(Aria.getClassRef("test.aria.core.testResMgr.MyRes8"), null);
                ariaCoreResMgr.unloadResource("test/aria/core/testResMgr/MyRes8");
                self.notifyTestEnd();
            });
        }
    }
github ariatemplates / ariatemplates / test / aria / core / ResMgr2TestCase.js View on Github external
testAsyncCase4 : function () {
            var self = this;
            ariaCoreResMgr.currentLocale = "fr_FR";
            this.beginDownloadMgrMock([{
                        logicalPath : "test/aria/core/testResMgr/MyRes4_fr_FR.js"
                    }, {
                        logicalPath : "test/aria/core/testResMgr/MyRes4_fr.js"
                    }, {
                        logicalPath : "test/aria/core/testResMgr/MyRes4.js"
                    }]);
            ariaCoreResMgr.loadResource(null, "test/aria/core/testResMgr/MyRes4").then(function (res) {
                try {
                    self.fail("Loading MyRes4 should not succeed.");
                } catch (e) {
                    self.handleAsyncTestError(e);
                }
            }, function (error) {
                self.assertEquals(Aria.getClassRef("test.aria.core.testResMgr.MyRes4"), null);
                ariaCoreResMgr.unloadResource("test/aria/core/testResMgr/MyRes4");
                self.notifyTestEnd();
            });
        },