Closed StarpTech closed 6 years ago
Hello, We are working towards creating js API for Propeller components.
A simple solution, work around could be rename all your document ready calls to a psuedo event.
$(document).on('page.load', function() { .... });
This would allow people to call a event if they needed to reload.
$( document ).trigger( "page.load" );
However this is sub-optimal... Maybe checkout UI Kit or other material design sites for how they work around this.
For now, I've modified my local to do the above so that Aurelia can be used.
@terrancesnyder thanks for the response. I already did it but this is ugly because you can't isolate a component from their depedencies e.g a form component in aurelia or riotjs should be responsible for bootstraping their elements not a global routine and without much copy & paste or modifying the library its not possible.
@StarpTech thanks, i needed something so just being pragmatic and adding this to gulp until that better solution is done. i'll follow this ticket if other ways come out.
const patchPropellerForDomLoad = gulp.src(`${source}/dist/js/propeller*.js`)
.pipe(changedInPlace({ firstPass: true }))
.pipe(replace('$(document).ready(function () {', "$(document).on('page.load', function() {"))
.pipe(gulp.dest(`${source}/dist/js`));
@terrancesnyder In Propeller V1.2, we have enhanced the components by developing jQuery Plugins to fetch the data dynamically. For more details, please refer: https://github.com/digicorp/propeller/releases/tag/v1.2.0
Every website has dynamic sections. As soon as I want to render a list from a ajax request I can't use the library to make this work. The last option is to copy paste and reinitiliaze all components. My suggestion is to provide a javascript api e.g by jquery plugins.
Further I would remove all html in javascript and provide a interface like in bootstrap.