React Component Lifecycle
- getInitialState
- getDefaultProps
- componentWillMount
- componentDidMount
- shouldComponentUpdate (Update only)
- componentWillUpdate (Update only)
- componentWillReceiveProps (Update only)
- render
| //Copyright (c) 2020 BlenderNPR and contributors. MIT license. | |
| #include "Pipelines/NPR_Pipeline.glsl" | |
| uniform sampler1D color_gradient; | |
| uniform vec4 line_color = vec4(0.0,0.0,0.0,1.0); | |
| uniform float line_id_boundary_width = 1.0; | |
React Component Lifecycle
| var width = $(window).width(); | |
| $(window).resize(function(){ | |
| if($(this).width() != width){ | |
| width = $(this).width(); | |
| console.log(width); | |
| // your code | |
| } | |
| }); |
| <?php | |
| /** | |
| * Use * for origin | |
| */ | |
| add_action( 'rest_api_init', function() { | |
| remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' ); | |
| add_filter( 'rest_pre_serve_request', function( $value ) { | |
| header( 'Access-Control-Allow-Origin: *' ); | |
| header( 'Access-Control-Allow-Methods: POST, GET, OPTIONS, PUT, DELETE' ); |
| { | |
| "name": "my-app", | |
| "version": "1.0.0", | |
| "description": "My test app", | |
| "main": "src/js/index.js", | |
| "scripts": { | |
| "jshint:dist": "jshint src/js/*.js", | |
| "jshint": "npm run jshint:dist", | |
| "jscs": "jscs src/*.js", | |
| "browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js", |
| <?php | |
| /** | |
| * Infinite next and previous post looping in WordPress | |
| */ | |
| if( get_adjacent_post(false, '', true) ) { | |
| previous_post_link('%link', '← Previous Post'); | |
| } else { | |
| $first = new WP_Query('posts_per_page=1&order=DESC'); $first->the_post(); | |
| echo '<a href="' . get_permalink() . '">← Previous Post</a>'; | |
| wp_reset_query(); |