mikromundo Posted September 8, 2019 Share Posted September 8, 2019 Hi, I tried to use toasty.js but i don´t have success. In CustomFiles: files\js\toasty\dist\toasty.css files\js\toasty\dist\toasty.js and in the delphi code: procedure TMainForm.htmlGruposAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = '_GrupoClique' then begin UniSession.AddJS( 'var toast = new Toasty();' + 'toast.info("Here is some information!");' + 'toast.success("You did something good!");' + 'toast.warning("Warning! Do not proceed any further!");' + 'toast.error("Something terrible happened!");' ); end; end; Somebody help me ? Link to comment Share on other sites More sharing options...
Administrators Farshad Mohajeri Posted September 10, 2019 Administrators Share Posted September 10, 2019 Problem is related to Toasty lib which requires document DOM to be ready when it is loaded. So you need to lazy load them using defer keyword: Please remove custom files from ServerModule and add these lines to Main.pas: initialization RegisterAppFormClass(TMainForm); UniAddCSSLibrary('toasty/toasty.css', False, [upoFolderFiles, upoPlatformBoth]); UniAddJSLibrary('toasty/toasty.js', False, [upoFolderFiles, upoPlatformBoth, upoDefer]); end. 1 Link to comment Share on other sites More sharing options...
mikromundo Posted September 10, 2019 Author Share Posted September 10, 2019 Thanks....I will test !!! Link to comment Share on other sites More sharing options...
mikromundo Posted September 10, 2019 Author Share Posted September 10, 2019 A friend said was runnit but not for me. Link to comment Share on other sites More sharing options...
Sherzod Posted September 10, 2019 Share Posted September 10, 2019 5 minutes ago, mikromundo said: A friend said was runnit but not for me. Hi, Can you make a simple testcase for reproduce? Link to comment Share on other sites More sharing options...
mikromundo Posted September 10, 2019 Author Share Posted September 10, 2019 Do you can put the sample ? I miss something, but i don´t see what ! Link to comment Share on other sites More sharing options...
mikromundo Posted September 10, 2019 Author Share Posted September 10, 2019 I Try all this: UniSession.AddJS( //'<script type="text/javascript">'+ '$(document).ready(function()'+ '{'+ 'var toast = new Toasty();' + 'toast.info("Here is some information!");' + 'toast.success("You did something good!");' + 'toast.warning("Warning! Do not proceed any further!");' + 'toast.error("Something terrible happened!");' + '})' ); // '</script>' ); // UniSession.AddJS( 'toast.info("Here is some information!");' + // // 'toast.success("You did something good!");' + // // 'toast.warning("Warning! Do not proceed any further!");' + // // 'toast.error("Something terrible happened!");' ); Link to comment Share on other sites More sharing options...
Sherzod Posted September 10, 2019 Share Posted September 10, 2019 Can you make a simple testcase?! Link to comment Share on other sites More sharing options...
mikromundo Posted September 10, 2019 Author Share Posted September 10, 2019 I Try all this: UniSession.AddJS( //'<script type="text/javascript">'+ '$(document).ready(function()'+ '{'+ 'var toast = new Toasty();' + 'toast.info("Here is some information!");' + 'toast.success("You did something good!");' + 'toast.warning("Warning! Do not proceed any further!");' + 'toast.error("Something terrible happened!");' + '})' ); // '</script>' ); // UniSession.AddJS( 'toast.info("Here is some information!");' + // // 'toast.success("You did something good!");' + // // 'toast.warning("Warning! Do not proceed any further!");' + // // 'toast.error("Something terrible happened!");' ); Toasty.rar Link to comment Share on other sites More sharing options...
Sherzod Posted September 10, 2019 Share Posted September 10, 2019 20 minutes ago, mikromundo said: Toasty.rar Replace by this: initialization RegisterAppFormClass(TMainForm); UniAddCSSLibrary( 'js/toasty/dist/toasty.css', False, [upoFolderFiles, upoPlatformBoth]); UniAddJSLibrary( 'js/toasty/dist/toasty.js', False, [upoFolderFiles, upoPlatformBoth, upoDefer]); end. Link to comment Share on other sites More sharing options...
belo Posted September 10, 2019 Share Posted September 10, 2019 Flavio, I made an example adapted to your needs. Best regards, Eduardo Belo Toasty JS Code Sample Link to comment Share on other sites More sharing options...
mikromundo Posted September 10, 2019 Author Share Posted September 10, 2019 Thanks @sherzod and @farshad and @belo... just really lack attention !!! Link to comment Share on other sites More sharing options...
almusx Posted September 13, 2019 Share Posted September 13, 2019 On 9/10/2019 at 5:16 PM, belo said: Flavio, I made an example adapted to your needs. Best regards, Eduardo Belo Toasty JS Code Sample Hi, can you help me to use this push.js library on my program? https://pushjs.org/ https://github.com/Nickersoft/push.js/archive/v1.0.12.zip Its show a Desktop notifictation by the browser. I appreciate your help with this, thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now