public MissingHelperFeatureFactory( HelperDescriptorBase returnHelper = null, BlockHelperDescriptorBase blockHelper = null ) { _returnHelper = returnHelper; _blockHelper = blockHelper; }
/// <summary> /// Allows to intercept calls to missing helpers. /// <para>For Handlebarsjs docs see: https://handlebarsjs.com/guide/hooks.html#helpermissing</para> /// </summary> /// <param name="configuration"></param> /// <param name="helperMissing">Delegate that returns interceptor for <see cref="HandlebarsReturnHelper"/> and <see cref="HandlebarsHelper"/></param> /// <param name="blockHelperMissing">Delegate that returns interceptor for <see cref="HandlebarsBlockHelper"/></param> /// <returns></returns> public static HandlebarsConfiguration RegisterMissingHelperHook( this HandlebarsConfiguration configuration, HelperDescriptorBase helperMissing = null, BlockHelperDescriptorBase blockHelperMissing = null ) { var feature = new MissingHelperFeatureFactory(helperMissing, blockHelperMissing); var features = configuration.CompileTimeConfiguration.Features; features.Remove(features.OfType <MissingHelperFeatureFactory>().Single()); features.Add(feature); return(configuration); }
/// <summary> /// Registers new <see cref="BlockHelperDescriptorBase"/> /// </summary> /// <param name="helperObject"></param> public static void RegisterHelper(BlockHelperDescriptorBase helperObject) { Instance.RegisterHelper((BlockHelperDescriptor)helperObject); }